Clojure on MacOS
To install the latest version of Clojure on MacOS, you first need to install Java, after which you can install Clojure.
To install Java, I use Temurin and pick the latest LTS (Long-Term Support) version.
Assuming you already have Homebrew:
brew install temurin
brew install clojure/tools/clojure
This will also install rlwrap
which makes sure that you can use the arrow keys in the REPL.
I also use neil
for some common aliases, for example, to create a new project.
brew install babashka/brew/neil
Now you can run the neil new
command to create a new Clojure repository.
Setting up Fish on the Mac
Fish shell is my shell of choice and having it setup
as default on the Mac requires some extra steps.
When homebrew is installed, run brew install fish
.
After that, edit /etc/shells
and add fish to it:
# sudo edit /etc/shells
Add the bottom of the file add:
/opt/homebrew/bin/fish
Then set the shell as default with:
chsh -s /opt/homebrew/bin/fish
It does require logging again to be activated.
Crisp fonts on Alacritty
I’m using Alacritty on the Mac and I noticed how the
font rendering is much thicker than I’m used to on iTerm. On iTerm I use the
“thin strokes” setting, which is not available in Alacritty.
Turns out, you can set it with:
defaults write org.alacritty AppleFontSmoothing -int 0
If you then log in and logout again, your Alacritty will be similar to the
crispness you find in iTerm.
If you want to restore it back to the default, do:
defaults delete org.alacritty AppleFontSmoothing
And if you like to have this kind of crispness across the entire OS. Do:
defaults write -g AppleFontSmoothing -int 0
Faster key repeat on the Mac
I like to have my key repeat set high, because I still browse my code line,
by line; yes, I know there are better ways to browse.
On the Mac, if you go through the “System Preferences”, there is only so much
you can do. Luckily, you can get the right settings if you use the terminal.
First, make sure that you have disabled “Slow keys” in “System Preferences > Accessibility > Keyboard > Slow keys”.
Then go into your Terminal of choice and type:
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 12
The normal minimum of KeyRepeat
is 2. Setting it to 1 will have a key repeat
delay of 15ms.
For the InitialKeyRepeat
, the minimum is 10; 15 if you use system settings. I
prefer to set it to 12.
If you want to restore the defaults, just go through the system settings and set
it to a value you prefer.
Install Emacs on the Mac
There are many ways to install Emacs on the Mac, from pre-build
Applications, to Homebrew, to installing from source.
My current favorite way to get the latest Emacs which has some
additional stuff for the Mac is by using a build script, which builds
Emacs from its source.
It’s called build-emacs-macos and is on Github. The instructions to use it are here in the README.