3 Self Signing Alacritty on macOS
Christian Duerr edited this page 2023-03-13 10:11:54 +00:00

Allow Alacritty to access your files

On macOS you might find that Alacritty causes popups asking for directory permissions over and over again, even if you click 'Allow'. This happens because Apple has moved towards requiring code signing on binaries that want privileged access to parts of your computer. In theory, this is a good thing, but Apple has also made it difficult and expensive to sign binaries if you are releasing open source software (like Alacritty). Following are instructions for setting up a self signing certificate and signing Alacritty.

Code Signing Alacritty on macOS 12.4 (on an M1 mac)

  1. Open up Keychain Access (can be found in Applications/Utilities)
  2. In the menu click Keychain Access > Certificate Assistant > Create a Certificate...
  3. Name your certificate something like Alacritty, Identity Type should be Self Signed Root, and Certificate Type should be Code Signing
  4. Click Create
  5. Open Terminal (can also be found in Applications/Utilities)
  6. Run the command sudo codesign -fs Alacritty /Applications/Alacritty.app

Note: In step 6 you must reference the Name you gave your certificate as the argument to -fs. ie. if you named your certificate "BartSimpson" your command would be sudo codesign -fs BartSimpson /Applications/Alacritty.app.

Removing the apple.quarantine attribute

You may need to also remove the apple.quarantine attribute to prevent MacOS prompting you about malicious software:

xattr -d com.apple.quarantine /Applications/Alacritty.app

Workaround if code signing is not working

In System Settings > Privacy & Security > Developer Tools enable Terminal. Now you should be able to launch alacritty from the Terminal.

Open Automator, create new Application and paste the AppleScript in a "Run Applescript" block. Save as AlacrittyLauncher.app in your Applications folder. You can find it now in the Launchpad and Spotlight search, and you can drag it into your dock.

on run {input, parameters}
	set killterm to application "Terminal" is not running
	
	tell Application "Terminal" to do script "alacritty&disown;exit"
	
	if killterm then
		tell Application "Terminal" to do script "sleep 1&&killall -HUP Terminal"
	end if
	
	return input
end run