emacs/var/elfeed/db/data/63/637418947beec6024ac748df922d10c35f3751b7
2022-01-03 12:49:32 -06:00

17 lines
4.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>The next issue I ran into was more complex. After fixing the packages, I wanted to browse my home folder on the Mac with Dired. I got an error that stated: <code>"Listing directory failed but 'access-file' worked"</code>. Huh? Whats that about?</p>
<p>When contents of a folder fails to list on a Mac, especially on more recent macOS versions, it usually means theres a permission issue. In Catalina and Big Sur, even the Native Terminal app needs explicit access to the hard drive from the user. I always found this odd, but I guess I can see why: if you dont know what the Terminal is and why it needs access (many users dont, unfortunately), its a good idea to keep it locked. Giving Emacs explicit access to the hard drive and folders was a no-brainer, However, that didnt help. I still received the same error message.</p>
<p>After some research on Stackexchange, I learned that the list (“ls”) command in macOS is different than the one in Linux. They both do the same thing and both historically date back to Unix, but theyve developed somewhat differently. the Linux ls program is the GNU ls command, which is the one Emacs “knows” how to use. This version of ls is bundled with other command line tools inside a package called coreutils, which can be installed with Homebrew. That was my next step, but I still encountered the error.</p>
<p>The same place online that suggested installing coreutils also gave instructions to change the path for Bash on macOS, so it can be found. This made sense; after all, if Emacs cant find the ls program, it would give the same error as if its not installed. So that was the next step. Zilch. The error persisted.</p>
<p>I was puzzled until a co-worker looked at this with me and noticed the path instructions are for bash (in <code>~/.bash_profile</code>). Bash, as the Mac users among you know, is not the default shell on macOS since macOS Catalina; it is now ZSH. The file to configure ZSH is <code>~/.zshrc</code>. That was a mistake that someone like me, whos coming from Linux and used to Bash, would not know to change.</p>
<p>With the path changed in the ZSH configuration file, Emacs was finally able to find the ls program and list the directories. Well, <em>most</em> of them. The Desktop and the Documents folder were giving me permission denied error when I tried to list their contents. This was strange since I already gave Emacs full access to the hard drive. More online research followed. What I found was interesting.</p>
<p>On macOS, Emacs runs inside a Ruby wrapper (this detail is buried <a href="https://www.emacswiki.org/emacs/EmacsForMacOS#h5o-34">on the Emacs wiki</a>). So, while its nice that I gave Emacs access to the hard drive, Ruby, which is (from my understanding) the “messenger” Emacs sends out to use the ls command in Dired, was denied access. The fix was to add Ruby to the access list under Security in macOS settings<sup id="fnref:1"><a class="footnote-ref" href="https://helpdeskheadesk.net/tags/emacs/index.xml#fn:1">1</a></sup>.</p>
<p>Only after Ruby had access I was able to see all the local directories I wanted. Its odd just how alienated macOS “feels” Emacs is. I understand the logic of whats going on, but still, the notion that I need to customize so many things to let something as free and good as Emacs is something Id grown to expect from Windows, not macOS. Oh well. <em>Cest la Vie</em>.</p>
<h2 id="footnotes">Footnotes</h2>
<section class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>This doesnt explain why other directories worked fine without giving Ruby explicit access. For example, I could view my Downloads folder just fine on the Mac. From what I read, I understand this has to do with the integration of iCloud, which the Desktop and the Document folders are a part of. My guess is that Ruby needs access to iCloud, or, that you dont access these directories at all, but some sort of cloud integration that just seems like folders, when in fact they are not. Whatever the case may be, that was the fix. <a class="footnote-backref" href="https://helpdeskheadesk.net/tags/emacs/index.xml#fnref:1">↩︎</a></p>
</li>
</ol>
</section>