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.

  1. First, we install the Doom’s dependencies:
# required dependencies
brew install git ripgrep
# optional dependencies
brew install coreutils fd
# Installs clang
xcode-select --install
  1. 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 /Applications every 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
  1. Open the GUI by running or just search for Emacs application:
open /Applications/Emacs.app

Installation (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 emacs

Run 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.

  1. Run Emacs as a background server:
emacs --daemon
  1. Emacs client in terminal:
emacsclient -t
  1. 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 emacs

There 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 ''"