Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But the open command doesn't allow you to pass the environment, and Apple seems hellbent on breaking every workaround they've implemented over the years (e.g. ~/.MacOSX/environment.plist).

So, doing Foo.app/Contents/MacOS/Foo is often the only way to launch a GUI app while inheriting the full environment that you have on the command line.

I often have to do this to launch various developer tools, and have them be able to inherent important environment variables, e.g. database credentials or secrets,



> But the open command doesn't allow you to pass the environment

Uh? I’ve been using open to pass NSZombieEnabled and other debugging stuff to apps all the time and it works.

From man open(1):

    Opened applications inherit environment variables just
    as if you had launched the application directly through
    its full path.  This behavior was also present in Tiger.


What?! Awesome! I would swear that was once not the case... (checks man page)

    Opened applications inherit environment variables just
    as if you had launched the application directly through
    its full path.  This behavior was also present in *Tiger*.
Sigh, I'm old...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: