Last active
July 24, 2025 18:53
-
-
Save railwaycat/4043945 to your computer and use it in GitHub Desktop.
Start Emacs.app from CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/"'