Create an app via Automator to open files in Emacs clients by double-clicks. Automator is a built-in OS X app for creating custom automated user workflows for just about any installed app you might have or even OS functionality. Suppose we could like to open files by default in the Emacs client named as main.You may open files in the Emacs.app, however, with too much user-defined. OS X Control and Command keys. Mac keyboards conveniently have separate Control, Meta (a.k.a. Option or Alt) and Command (⌘) keys. You have the traditional Emacs bindings on Control and Meta, and the OS X bindings on Command. As recommended previously, you should strongly consider re-binding Caps Lock to Control, system-wide.
Since the upgrade to macOS Catalina, I’ve had two serious annoyances with Emacs. Here’s a little insight into how I fixed them.
Emacs On Mac Os XIssue 1: I Couldn’t Access Certain Folders
After the upgrade, Emacs was unable to access special folders, like the Documents folder. This is a ramification of the User Data Protection enhancements that were made in Catalina.
![]()
Here’s the gist of why this exists: In a previous version, macOS started displaying user prompts (similar to iOS) to grant application permission for accessing things like contacts, photos, location, etc. These prompts were displayed when using special APIs designated for those purposes.
Alas, there was an easy way to bypass these prompts. Rather than using APIs to, say, access your contacts, you could just read the contact database via the filesystem. Catalina now enforces these permissions at the filesystem APIs, as well. This means that, because it doesn’t even ask for permission, Emacs is simply forbidden from accessing certain files.
Apple did provide an escape hatch: Full Disk Access. You, the user, can provide this privilege to an application, and it is allowed to access all files that your user would otherwise be able to access. It’s pretty easy: Go to the Security section of System Preferences, find Full Disk Access in the list, and then add Emacs:
But…this solution didn’t work. After doing this, I still couldn’t access my documents folder. Solving this is directly related to the second issue that’s been nagging me since the upgrade to Catalina.
Issue 2: Spotlight Can’t Bring Emacs to the Front
I commonly switch between applications on macOS by pressing
cmd-space to bring up Spotlight, then the first few letters of the application name, and finally return. It’s often quicker than finding the icon via cmd-tab . Unfortunately, this method stopped working, too.
As it turns out, the binary embedded in Emacs.app is…actually not a binary. Instead, it’s a Ruby script. From the script:
Although this never caused problems on prior versions of macOS, here, it is responsible for both of these issues:
Mac Install Emacs
The Solution
On Catalina, the Ruby script will always choose to launch the bundled binary
Emacs-x86_64-10_14 . So, if you simply move it in place of the Emacs launcher script, everything starts working as normal. At the Terminal, just run these commands:
Emacs Os
And, with that, Emacs should correctly receive its Full Disk Access permission, and Spotlight will correctly bring it to front (n.b., it’s still required to add Emacs to the Full Disk Access section of the security system preferences).
![]() Emacs Mac Port
Note that, because we have been performing surgery on the Emacs app, its code signature is no longer valid. The last command above removes the code signature from the Emacs binary. Blu ray software free mac. On my machines, I had no issues. If you can’t launch Emacs after running these commands, try following the steps in this document from Apple.
Conclusion
One final caveat: This works for me using homebrew-cask-installed Emacs version 26.3. In future versions of Emacs, it’s possible that the correct binary might be something other than
Emacs-x86_64-10_14 .
If you’ve been plagued by these problems, I hope this post helped.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |