Install Emacspeak on Modern Macs


Introduction

I had a bit of a hard time finding the exact steps to get emacspeak up and running on MacOS 12+ (Sierra, Ventura) on either x86 or m1/m2.

This guide will hopefully get you from nothing working to functional install as quickly as possible.

Install Brew

Follow instructions to install brew via https://brew.sh – but generally the command below will work.

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

NOTE: if you just updated major OS versions, it is often easier to just reinstall brew than to try to fix any issues you might have with it. If you do not have xcode command line tools, this will trigger an install. This can appear to hang at times, be patient.

Install mplayer and python

Open the program terminal, in it run

brew update 
brew upgrade
brew install mplayer python sox

Install emacs

Still in the terminal, we will install https://github.com/d12frosted/homebrew-emacs-plus

brew tap d12frosted/emacs-plus
brew install emacs-plus@29 # as of time of this writing

NOTE: This process can take awhile, and will appear stalled sometimes, just wait it out.

Install required python libraries

Once again, still in terminal

pip3 install pyobjc

NNOTE: If you end up with a emacs that works perfectly from a termijnal but when launched as an application from finder it does not work, it is probably an environmental issue, you can prepend “env -i” to the above pip3 command to run it without any environment setup, and should fix your issue

Install Emacspeak

Download the latest release (it will be a .tar.bz2 file) from https://github.com/tvraman/emacspeak/releases

Then, back to our trusty terminal. By default it should have been downloaded to your Downloads folder, so we will go there

NOTE: This might give a security warning if you never accessed Downloads from the terminal before, just allow it.

cd ~/Downloads	

In the next few commands you will use tab to autocomplete the emacspeak files and directories so this guide will age marginally better.

tar -jxvf emacspeak # (and then hit tab to auto-complete the filename)
cd emacspeak # (and then press tab to autocomplete directory)
make config
make
mkdir -p ~/.emacs.d/emacspeak
mv * ~/.emacs.d/emacspeak

Configure Emacspeak

NOTE: In this section we will use emacs, but emacspeak will not be working yet, so your other accessibility tools will integrate with it for now.

Edit the first line to use python3 instead of python, save and exit

emacs ~/.emacs.d/emacspeak/servers/Mac

After that we will paste in some lines into the init.

emacs ~/.emacs.d/init.el

Paste in the following lines.

(setq load-path (cons "~/.emacs.d/emacspeak/lisp" load-path))
(setq emacspeak-directory "~/.emacs.d/emacspeak")
(setq dtk-program "mac")
(require 'emacspeak-setup)
(dtk-set-rate 200 t)

NOTE: When it first starts it might be a bit too fast, it will slow down after the server initializes

Is it working?

Open emacs and you should hear “Welcome to emacspeak” which is played via mplayer and then the normal emacspeak server will start to work after a second or two. If you using VoiceOver, you will hear lines read twice and it will be painful, just toggle off VoiceOver for a moment and read on.

Making Emacspeak and Voiceover Play Nice

Now, if you are actively using VoiceOver, you will have to turn it off when you load emacs else you will hear each line twice.

I have a bit of a kludge, and it isn’t perfect, but I like it.

I setup a VoiceOver activity for emacs. You can do this in the VoiceOver utility. The activity I setup only has two properties.

  • It is enabled automatically when emacs has focus
  • It sets under voices “mute voices” which will stop all VoiceOver voices without interfering with anything else and will turn it back on when you switch apps

This isn’t without problems, you will not hear notifications or other noises from VoiceOver, but if you are willing to be in a mode where you are entirely focused on emacs, it can work.

Certain things work very poorly like trying to use the emacs gun menu while this mode is on, but it is easy to toggle activities in VoiceOver.