I'm trying to figure out how to launch an app (in this case Discord) by default with added commands, and as such I figured I'd use Automator to create an app that runs a shell command. The command in question is as follows:

MKL_DEBUG_CPU_TYPE=5 /Applications/Discord.app/Contents/MacOS/Discord

I put that on Automator, on the "Execute shell script" action, save it as an application, and when I put the app on the Dock, when I launch it, it shows two icons. Well, the cause of this is obvious, it's not launching the app itself with that command, what is in the dock is just a glorified terminal window which always launches the discord app with that command.

My question is: Is there a way I can do it so the command doesn't show two discord icons, and the discord window opens in itself?

Also because language barriers and bad communication are a thing, here are a few screenshots that illustrate my question better than words can

The Automator app, on the Dock The Automator app, on the Dock After launching the Automator shortcut, this is what happens After launching the Automator shortcut, this is what happens This is what I'd prefer to happen This is what I'd prefer to happen

Edit: I'm not sure if this was clear to you guys, I wasn't even aware of this, but it seems that MKL_DEBUG_CPU_TYPE=5 acts as a command itself, which then runs the mentioned app with it's own properties, it's not a command parameter that Discord.app recognizes

Edit 2: Just to clear things out a bit more, when I run the Automator Application, it doesn't show the white dot that indicates the app is running, nor does it show the notifications number that stock Discord does, and that's what I'd like to happen on the Automator app, while hiding the real Discord icon from the dock

  • Use a different icon to distinguish the two things?
    – benwiggy
    Commented May 26, 2020 at 17:49
  • @benwiggy That is a possibility, and as a last resort I might do it, but I'd rather have one single Discord app that inherits the logo and just patches that command in, Automator seems to be the closest I'd get to this Commented May 26, 2020 at 18:05
  • What is the purpose of the command?
    – benwiggy
    Commented May 26, 2020 at 18:28
  • I believe the command makes it so that Discord uses a different instruction set, as that one isn't compatible with my setup. Basically what happens is that voice chat makes the app reboot and pretty much bootloop because it tries to go back to the previous voice chat it crashed on, perpetuating the crashing and restarting Commented May 26, 2020 at 22:36
  • @FranckTheMiner which macOS are you on ?
    – anki
    Commented May 27, 2020 at 7:00

4 Answers 4


Does it have to be Automator?

I have an app which will take additional parameters at launch, which I do by saving an Applescript as a self-contained App.

The basic config is

do shell script "\"/Applications/NameOfApp.app/Contents/MacOS/NameOfApp\" -param1 -param2 -param3"

Edit - Ah, reading more carefully, nope, that doesn't hide the icon of my applescript whilst it's running, & it will not quit until the launched app is itself first quit… but it wouldn't be confused for the app itself.
They are parent/child processes so will be displayed individually in the Dock.

You may be able to hide it like this question - Hide a running app from Dock?
…which rather makes this answer a bit pointless ;-)


Instead of launching the Application executable directly, use the open command on the app bundle. E.g.:

open "/Applications/Discord.app"
  • Hey, I tried your tip, but it didn't work, cuz as it turns out the MKL_DEBUG_CPU_TYPE=5 acts as a hard-coded command on terminal, kind of like you'd do chmod, nano, all that stuff, so it isn't a parameter that Discord recognizes, and doing "open MKL[...]" just errors out saying "the file /users/[username]/MKL[...] does not exist" Commented May 26, 2020 at 18:10
  • I don't think I understand what you're doing. open is a command-line BSD program like any other, including chmod, nano, etc—it lives at /usr/bin/open. You should be able to pass arguments to the application being opened by adding them at the end, see man open. Commented May 26, 2020 at 21:11
  • Exactly, the point is from my experience by fooling around with this problem, it seems like MKL isn't an argument that Discord then recognizes, it's some sort of master-command that runs Discord by itself, I honestly have no clue what it is in practice, but the effect is that open isn't playing well with this situation Commented May 26, 2020 at 22:20
  • @FranckTheMiner MLK... is an environment variable. I'm assuming opening an app doesn't preserve the current environments environment variables. Commented May 27, 2020 at 4:41

This answer works only if you're using bash.

Since you have Terminal open, as we see in the screenshot, the best way is to use an alias. It's the least friction way to do it. I myself have these aliases:

enter image description here

  • Run

    open ~/.bash_profile

    Or use this answer to use GUI: https://apple.stackexchange.com/a/371665/313842

  • Add a line among other aliases:

    alias discordapp="MKL_DEBUG_CPU_TYPE=5 /Applications/Discord.app/Contents/MacOS/Discord"
  • Then run either of:

    source ~/.bash_profile
    . ~/.bash_profile

The best part is, you get autocomplete too. Type some initial letters of the alias, & hit tab.

You can also add more arguments to the command. For example, I run this:

octaveg --force-gui

octaveg as defined above.

  • Hey, I tried your suggestion, and it seems to make sense, however when I applied it, I executed "open ~/.bash_profile" and it errored out, saying it didn't exist, so I added the line with nano, and all was good. I went to do ~/.bash_profile, and as expected it didn't work cuz it wasn't executable, I chmod'ed it in, executed it with sudo, and nothing happened I then tried finding discordapp on spotlight, and also tried simply doing discordapp on terminal, and both didn't work, spotlight didn't find it and terminal said the command wasn't found Commented May 26, 2020 at 22:33
  • @FranckTheMiner 1 There are several problems with what you did. If you're on Catalina, it simply wont work since it is for bash and catalina uses zsh . Can you check again the creation date of .bash_profile in /Users/<you>/ using apple.stackexchange.com/a/371665/313842 this answer ? 2 you're not supposed to used sudo at anything that you don't know about. 3 "it didn't work cuz it wasn't executable" did you see the .. ? "period" was the command & ~/.bash_profile was the argument. 4 See the updated answer.
    – anki
    Commented May 27, 2020 at 7:04
  • Sorry for the delay in response, I just kinda forgot about this, but I'm extremely confused as not only did .bash_profile not exist on that directory before I added it, but I also believe your commands might be obsolete, as doing open ~/.bash_profile doesn't return anything, and then there's the whole matter that zsh is defaulted instead of bash, and I can't even seem to get bash to work when I try. Also I sudo'ed what I did because I'm aware in theory it only refreshed bash's Alias list, so there's not a lot to go wrong there... Commented May 30, 2020 at 2:03
  • No problem. You need to relax. I’m on Mojave. You had not mentioned your os in the question, so I assumed that you’re on the same. So I answered how bash works. (See the heading of my answer) Now that I know you’re on Catalina, and it uses zsh as the shell, this answer directly can’t help you since it has different syntax, different files and different commands. So you should find out how to add aliases in zsh. Which files are relevant for that purpose (.zsh_profile I think) etc.
    – anki
    Commented May 30, 2020 at 4:36
  • Use method 1 as given here: apple.stackexchange.com/questions/371867/…
    – anki
    Commented May 30, 2020 at 6:14

Ok I found a workaround and it sure does what I wanted. Basically you go to the app's /Content/MacOS directory, find the main executable (so in my case it's Discord), rename it to something else, like Disicord or whatever you want. Then sudo nanointo the same directory, and write "MKL_DEBUG_CPU_TYPE=5 [PathToExecutable]/[CurrentRenamedExecutableName]", and voilà, you get both the app to launch with that mode on, and you inherit both the icon and the notifications

HOWEVER, ATTENTION!!!! This seems to pose a somewhat relevant security threat, as any permissions submitted by the application get assigned to sh, and that doesn't sound like a smart thing to do, so watch out if you do this

  • "This seems to pose a somewhat relevant security threat, as any permissions submitted by the application get assigned to sh" Oh come on Apple, that doesn't make any sense! The modification described in this answer is a perfectly normal thing for an app bundle to do. This philosophy of grafting new, non-UNIX permission systems on top of standard UNIX is broken. Commented Jun 1, 2020 at 15:08

You must log in to answer this question.

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