Getting emacs working on OSX Monterey

security and permissions

Published November 12, 2021 #emacs, #osx, #homebrew

I recently got a new MacBook Pro. I still love my old Pixelbook, but I'm running too many docker containers on it and its slowing down my development time. In addition to the beautiful screen, zippy processor and charge it whenever you feel like it battery life, the speakers on the new MacBooks are mind blowing. But, of course we need emacs.

Also, ports and function keys. Finally.

Install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)

Then run the “next steps part”

Install emacs

brew install --cask emacs

The cmd-space emacs to start the application.

Security settings

  1. Go to System Preferences

  2. Security, then unlock to make changes

  3. Enable the binary

  4. Then go to Privacy

  5. Enable Full Disk Access for emacs

Fix Emacs.app to get access prompts

There's a launcher script to figure out what version of the emacs binary to start up depending upon the architecture, which confuses OSX. We'll need to get rid of this in order to help OSX figure out what's happening.

In a shell:

  cd /Applications/Emacs.app/Contents/MacOS 
  mv Emacs Emacs-Launcher
  cp Emacs-arm64-11_2 Emacs
  cp Emacs-arm64-11_2.pdmp Emacs.pdmp

Change caps lock and remove Mission Control hijacking

  1. Go to System Preferences

  2. Select Modifier Keys

  3. Change Caps Lock to be Control

  4. Go to Mission Control

  5. Unset the C-up and C-down so that emacs gets it.

Emacs specific settings

It's also useful to remap the Command key into Meta in the emacs world, which you can do in your init.el with:

  (setq mac-option-key-is-meta nil)
  (setq mac-command-key-is-meta t)
  (setq mac-command-modifier 'meta)
  (setq mac-option-modifier nil)

Fonts

Another handy thing to do is to add fonts from homebrew. This isn't really necessary, but here for reference:

brew install svn
brew tap homebrew/cask-fonts
brew install font-inconsolata
brew install font-roboto-mono
brew install font-fira-code

Conclusion

This is a nice machine.

Read next

See also

SQL in Org-Mode

Everything in org-mode

I do a lot of sql, and I do a lot of org-mode. Lets put them together. Native SQLite In org-babel-load-languages turn on sqlite. (You can use customize for this if you don't have another method in use.) Then you have a source block that looks like _#+begin_src sqlite :db test.db :colnames yes create table if not exists greeting(one varchar(10), two varchar(10)); insert into greeting values( 'Hello', 'world!

Read more

Setting up emacs for typescript development

If we are going to bother with static types, might as well use them

I've been playing with deno and typescript, so I thought I'd document how to setup a basic tide environment with emacs. Prerecs Things will go better if you have nativejson support in your emacs build. I build from scratch which is super easy, but to check what you have you can run the following elisp: (if (functionp 'json-serialize) (message "Native JSON is available") (message "Native JSON is *not* available")) Native JSON is available You also will need Node > 0.

Read more

Emacs Blog Writing and Navigation Mode

emacs and hugo sitting in a tree

This blog is basically my labnotes where I explore different parts of technology. Almost all of my coding related activity starts off in this repo, while I explore different things to see how they work. I have a lot of things in drafts, and I wanted to learn how to build a simple emacs interface to let me navigate around my file system. I couldn't find any good documentation on how to do anything with tabulated-list-mode so I spend the evening poking around and seeing how it works.

Read more