I currently have the Terminal in my dock. I'd like to have another Terminal shortcut in the dock but with this one it will run a bash script which will do some stuff specific to that shortcut.

No, I cannot use .bash_profile since the original Terminal short cut will source that too.

This is pretty trivial to do in Windows, is it trivial on a Mac also?

  • Can you clarify "which will do some stuff specific to that shortcut"? – benwiggy Apr 8 at 13:05
  • @benwiggy Run a bash script of my liking. – Karl Morrison Apr 8 at 13:10
  • Are you just trying to just execute a shell script that runs to its completion and the session terminates, or are you trying to open a new instance of Terminal that stays open, is interactive and has a different environment then Terminal normally has? Which is it? – user3439894 Apr 8 at 13:27
  • @user3439894 Stays open and is interactive! – Karl Morrison Apr 8 at 13:35

You can have files in the Dock, but they have to be the other side of the 'dividing line' from apps.

So a shell script file, with suffix .command, or .tool, could be in the Dock and would launch on a click.

There are other places to have scripts readily accessible in the Mac workspace, of course, such as the Scripts menulet.

  • What I want basically is to open a terminal window that has sourced a bunch of files. Basically .bash_profile but specific for this terminal shell session. – Karl Morrison Apr 8 at 13:11
  • Ok thanks, it's working now, made a command script, added to the dock, ran my stuff and then sourced .bash_profile then ran bash. Working as intended, ta. – Karl Morrison Apr 8 at 13:34
  • Instead of sourcing .bash_profile I added apple.stackexchange.com/a/357362/123669 to the .bashrc file. – Karl Morrison Apr 8 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .