Skip to content

Instantly share code, notes, and snippets.

@railwaycat
Last active July 24, 2025 18:53
Show Gist options
  • Save railwaycat/4043945 to your computer and use it in GitHub Desktop.
Save railwaycat/4043945 to your computer and use it in GitHub Desktop.
Start Emacs.app from CLI
#!/usr/bin/perl
# Emacs starter for Emacs mac port
# Thanks to Aquamacs Project and David Reitter
my $args = "";
my $tmpfiles = "";
for my $f (@ARGV) {
$args .= '"'.$f.'" ';
$tmpfiles .= '"'.$f.'" ' if (! -e $f);
}
system("touch $args") if ($tmpfiles);
system("open -a /Applications/Emacs.app $args");
# delay deletion because AE drag&drop doesn't work with non-existing documents
system("(sleep 3; rm $tmpfiles) &") if ($tmpfiles);
exit;
@dhaley
Copy link

dhaley commented Jul 24, 2025

On macOS, I like this solution:

osascript -e 'tell application "Finder" to make alias file to POSIX file "/opt/homebrew/opt/emacs-mac@29/Emacs.app" at POSIX file "/Applications/"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment