Emacs on macOS, Part 1

If it wasn’t for Emacs and other Linux tricks I’ve learned, I’d be happy with my office Mac. But That’s not how I do things. As it turns out, the transition from Linux to macOS wasn’t as smooth as I thought. I have a lot of troubleshooting to cover, and I hope to do so in a couple of parts. Here’s the first part of my recent adventures.

With my work responsibilities gravitating toward JAMF and remote Apple device support, an irony became clear: I haven’t used a Mac. 90% of my work was done on a PC with a VM that housed Emacs since I developed my org-mode routine. This came to light in a recent work meeting, and so it was decided. My main work machine now is a Mac.

I run Linux full time for my personal needs. Both my home Desktop, which I write this post on right now, and my Lenovo Thinkpad I take with me on trips run Linux Mint. I hope you’ll excuse me then for not knowing that you can turn on right-click on a magic mouse, or that you can copy-paste whole lines of code into the Terminal simply by dragging them. These sort of things become obvious only when you use a Mac day-to-day, which is what I spent my first couple of days on; getting myself to feel at home.

With the basics done and the Mac ready to do work1, it was time for the main event: installing Emacs from Homebrew and run it naively. I still have the option of remoting into my PC with the VM on it and run Emacs in a Linux environment, but the fun is in trying new things.

I also had a new challenge to conquer. I wanted to keep my org files off the Mac. My personal org files are saved on a folder named “Personal,” which I only sync to my personal machines; this time though, I wanted everything off the hard drive. This included my “Archive” folder with its many (over 100) weekly org files containing my tasks and projects for work. I’ve been using TRAMP regularly to access files at home on my Synology, so that was the solution I was aiming for.

After working out a newbie problem with Homebrew2, I got Emacs installed. Next, I wrote the lines to load MELPA in my init, since I needed to install my packages before I could run my full settings file, which uses these packages.

I launched Emacs and was ready to start installing my familiar packages. Instead, I encountered my first issue: Error retrieving: https://melpa.org/packages/archive-contents (error connection-failed "connect" :host "melpa.org" :service 443) It took some research, but I found out that (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") solved that problem. I am not sure exactly why, but that’s the solution that ended up working. Now that I was able to load MELPA, I started downloading the packages I needed one by one by looking into my Emacs_settings.org file, which I where I save my global Emacs settings with instructions.

Usually, I just copy over my Emacs packages over scp (usually in Emacs, over TRAMP already) and fix whatever issues remain from inside Emacs. This time though I wanted an independent setting file which will define a different path (one that would include the TRAMP syntax to dial back home) for my agenda folders. I thought it would also be a good idea to install the packages fresh instead of relying on packages that are working in Linux.

I’ve encountered a couple of Mac issues that I wasn’t prepared for along the way, but this is is where I’ll pick up the story next time.

Footnotes


  1. One (obvious?) thing I want to mention is that remoting into a Windows computer with a Mac is a breeze. Microsoft Remote Desktop automatically launches the connected machine full-screen, and then it’s a simple two-finger swish to move back and forth. My Windows keyboard (it’s the Microsoft ergonomic design, which is why I keep it; otherwise I’d switch to a Mac keyboard) makes it easy to switch back to “Windows Mode” in my head. But try to remote to a Mac from a Windows machine. Ugh. Unless you use VNC, which comes with its own bag of issues (not to mention security problems) you have to count on some third party software, and these have been a mixed bag of pain in the rear. ↩︎

  2. Since all programs have to be installed under an admin account, I wrongly assumed Homebrew also needed to be installed this way. This later caused a bunch of permission problems and difficulties installing (brew) different packages. I found out about this problem with a friend and good ol' Brew doctor and fixed these permission issues. ↩︎