0

I want to run a command every-time I click an app icon. I want that app icon in my launcher or app drawer and dock.

The Command I wanna run is this (posted here)

open -na "Google Chrome" --args --profile-directory="Guest Profile"

UPDATE 1:

I've created a "Chrome.sh" file on desktop with above command as content and running

sh chrome.sh

opens up the window that I want. now how do I convert that to an ".app" icon?

  • Would making it a .command (and adding execute permission) -- see "Open shell script from Finder interactively" -- do what you want? It's still a document, so you'd have to put it in the right side of the Dock with other documents. – Gordon Davisson Feb 26 at 4:05
  • I found a better way and already made it possible. Should I post an answer? because I think it'll really help people who wanna run multiple users in chrome – Sumeet Deshmukh Feb 26 at 4:12
  • 1
    Yes, please. A big part of the goal of the stackexchange network is for people to be able to find ready-made solutions/answers/whatever, so they don't have to re-invent it themselves (and to avoid this problem). – Gordon Davisson Feb 26 at 4:37
0

These steps are suitable for my use case only. depending on what you wanna do, Changes should be made to the sh file that you're going to create

1) Download the Script called "appify" from Here

2) copy that file to /usr/local/bin, which requires root privileges

3) Fire up Terminal.app and enter

sudo chmod +x /usr/local/bin/appify

to make appify executable without root privileges.

3) make a chrome.sh file on desktop with content

#!/usr/bin/env bash
/Applications/"Google Chrome.app"/Contents/MacOS/"Google Chrome" --args --profile-directory="Guest Profile"&

4) make sure that the .sh files works by trying this command

sh chrome.sh

5) Run following Commands

cd desktop
appify chrome.sh "My Chrome"

Now this will Create a File called "My Chrome.app" which can be moved into the applications folder and can be used like a normal app.

| improve this answer | |

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