1

I have a bash shell script that runs on login. Even though I selected the "hide" checkbox in system preferences, iTerm still shows while running it.

How do I completely hide it?

4

Try to run the script with launchd instead. Save a property list like this as ~/Library/LaunchAgents/some.label.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>some.label</string>
  <key>Program</key>
  <string>/path/to/script</string>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

The script should be run the next time you log in. Make sure the script is executable (chmod +x /path/to/script) and starts with an interpreter line (like #!/usr/bin/env bash).

You can also replace the Program key with for example

<key>ProgramArguments</key>
<array>
  <string>say</string>
  <string>a</string>
</array>

or

<key>ProgramArguments</key>
<array>
  <string>bash</string>
  <string>-c</string>
  <string>say a;ls|say</string>
</array>

See man launchd.plist or http://osxnotes.net/launchd.html for more information.

  • What is the label thing? – cfischer Nov 22 '13 at 11:44
1

Worked great to solve the Mavericks bluetooth always discoverable nightmare using the following script:

#!/bin/sh

defaults -currentHost write com.apple.Bluetooth DiscoverableState -bool no

launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist 2> /dev/null

launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist

You must log in to answer this question.

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