Tag: script

Simple startup script for OSX

Posted by – January 20, 2011

Somebody just got a new macbook and he wanted to run something every time it is turned on.

To create a startup script on OSX is not hard. Just a few steps.
Firstly, make a folder in /Library/StartupItems. Then create a plist file and an executable file. That’s it.

Let’s start with open Teminal and..

$ cd /Library/StartupItems
$ sudo mkdir WhatEverNameYouWant
$ cd WhatEverNameYouWant

and then create a file named StartupParameters.plist.
You can use whatever text editor to create and add..

{
  Description     = "WhatEverNameYouWant";
  Provides        = ("ScriptNameYouWant");
  OrderPreference = "None";
}

Next, create ScriptNameYouWant and put the commands you want.
Don’t forget to start the file with shebang #!/bin/sh to execute with Bourne shell.
This can be other. It depends on what you will execute.

The file will look like..

#!/bin/sh
The commands to execute
commands
and the last command

Save and make it executable..

sudo chmod +x ScriptNameYouWant

and restart your mac. See what you fuckup your Mac lol