Installation (MacOS)
There’s a lot of options on how you can install Emacs on MacOS. Majority of those option have bugs and compatibility issues. Doom Emacs have a guide here on what are the most preferred ways.
I will be using Homebrew to install it.
- First, we install the Doom’s dependencies:
# required dependencies
brew install git ripgrep
# optional dependencies
brew install coreutils fd
# Installs clang
xcode-select --install- Out of 3 options mentioned in the guide, we will install emacs-mac. For CLI helper, we are using Starter Script 1 and for GUI helper, we are using Helper 1 option (these are already handled in the below code block). You might have to redo
cp -a $(brew --prefix)/opt/emacs-mac/Emacs.app /Applicationsevery time we update Emacs.
brew tap railwaycat/emacsmacport
brew install emacs-mac --with-modules --with-starter
cp -a $(brew --prefix)/opt/emacs-mac/Emacs.app /Applications- Open the GUI by running or just search for Emacs application:
open /Applications/Emacs.appInstallation (Linux)
Here are the possible ways to install Emacs on Linux. I am currently using Omarchy as my main Linux distro, so I will use Pacman to install Emacs:
sudo pacman -S emacsRun Emacs in Terminal (TUI)
Since I access Omarchy machine over SSH mostly, I can run Emacs without GUI:
emacs -nw-nw= no windows- It will run Emacs inside the terminal like Neovim.
Run Emacs as Daemon and Client
There are many benefits if we run Emacs as server-client, like, instant startup, persistent buffers/files, Emacs background server can keep running and many more.
- Run Emacs as a background server:
emacs --daemon- Emacs client in terminal:
emacsclient -t- Typing above 2 commands is too much, there is a shortcut way:
emacsclient -t -a ''It means opens Emacs instantly (client) and starts daemon automatically if not already running.
We can also kill the Emacs daemon using:
pkill emacsThere are few bugs related to Org Mode when I run Emacs over SSH, so I haven’t fully adapted my workflows to use Emacs. For now, I am sticking with Neovim for work over SSH.
Configuration
Alias
I mainly use the following aliases for running Emacs as TUI:
alias e="emacs -nw"
alias emacs="emacs -nw"I could also do if I wanted to save startup time, session persistence and instant client loading (given Daemon was already running):
alias e="emacsclient -t -a ''"
alias emacs="emacsclient -t -a ''"