Create a alias with a parameter / command

How can I create a alias with a special command (in this case for opening Firefox with a specific Profile).


In Terminal it is: /Applications/Firefox.app/Contents/MacOS/firefox-bin -P "profileName"


In Windows it's a right-click on the link and add the parameter. I did not find out how to solve this on mac.

Posted on Oct 1, 2023 8:51 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 1, 2023 2:26 PM

OK, I found a much "nicer" solution. No terminal session.


  1. Open Automator
  2. Create new Application
  3. Select Shell-Script and add:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -P ProfileName &

Save as app - if you want change icon - go to the app you want icon from - open info - click on icon - copy, go to the automator-app - open info - select icon - paste icon.


There are no 2 apps open, no terminal session etc.

5 replies
Question marked as Top-ranking reply

Oct 1, 2023 2:26 PM in response to VikingOSX

OK, I found a much "nicer" solution. No terminal session.


  1. Open Automator
  2. Create new Application
  3. Select Shell-Script and add:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -P ProfileName &

Save as app - if you want change icon - go to the app you want icon from - open info - click on icon - copy, go to the automator-app - open info - select icon - paste icon.


There are no 2 apps open, no terminal session etc.

Oct 1, 2023 11:02 AM in response to VikingOSX

I have found that if you profile firefox-bin --profile <path> that you can entirely by-pass the Profile panel that Firefox opens when using the -P argument. That is the full path to the profile folder without the angle brackets.


The following when run as ff.command will prompt you for that full profile path which you can get by pressing the option key while clicking the ~/Library/Application Support/Firefox/Profiles/*.default folder name. That command sequence will put the full path on the clipboard and you can simply paste that into the AppleScript display dialog. The whole path pastes, but the dialog only shows the folder name.


#!/bin/zsh

FF="/Applications/Firefox.app/Contents/MacOS/firefox-bin"

function get_profile () {
osascript <<-AS
use scripting additions

try
set profile to text returned of (display dialog "Enter the path to your Firefox profile:" default answer "") as text
# set profile to "/Users/*****/Library/Application Support/Firefox/Profiles/ww1by5ws.default"
on error -128
return
end try
return profile as text
AS
return
}

thisProfile="$(get_profile)"
${FF} --profile "${thisProfile}" http://www.apple.com -- 2>&1 /dev/null &
exit 0



[Edited by Moderator]

Oct 1, 2023 9:55 AM in response to VikingOSX

Thanks a lot for this.

While waiting to a anwser i fount a solution to use scripts for this

do shell script "/Applications/Firefox.app/Contents/MacOS/firefox-bin -P ProfileName"

and adding a Icon to it when export as app.


Your solution seems to be a bit slower - but dont show me 2 open apps for 1 - and works like a charm. Thanks for your help.


Just a sidenote: i started to love MacOS - i just dont get it why there have to be a workaround for such a (easy) task. I never would come to your solution to create a shell-script by my own :)

The contra on this is, it's looking not that nice to have files with .command on desktop. i think changing the icon is possible. But for now it is a easy doing solution :)

Oct 1, 2023 9:51 AM in response to SoDaHoE

The Terminal in macOS exposes you to the UNIX command line, something that is not in Windows. You cannot alias a Terminal command to the Desktop in macOS.


But you can place a text file on your Desktop arbitrarily named ff.command (where .command is required) with the following contents which you can edit for your -P "profileName" need in that script as you cannot pass any parameter to a .command file:


#!/bin/zsh

/Applications/Firefox.app/Contents/MacOS/firefox-bin http://www.apple.com -- 2>&1 /dev/null &
exit 0


You make this ff.command file executable, and then you just double-click it in the Finder. It will launch Firefox and quit the momentary Terminal application necessary to launch it. Any standard out and error are redirected to the bit bucket leaving Firefox running.


You can pass a parameter to an Automator application or even an AppleScript, but not a .command script since its only user input is that double-click.


Tested: macOS Sonoma 14.0 and Firefox 118.0.1.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Create a alias with a parameter / command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.