Terminal and Unix Executable Startup Item

Discussion in 'Mac Programming' started by macsrules, Feb 28, 2008.

  1. macsrules macrumors regular

    Feb 26, 2008
    Okay if you read my Last post you know what's going on. I am really close. Just need a couple of questions answered and I am there. Here's where I am. I am sure this is basic to all the Unix people out there.

    Through Terminal using the command man tcsh > new_file I created a new file.

    Then I opened the new_file and placed a terminal command that I want executed each time my mac starts up.

    I then used terminal to move the file into the /System/Library/StartupItems

    I then ran the terminal command chmod u=rwx,g=rx,o=r

    This set the permissions on the file and made it a Unix Executable File.

    I restarted my computer and this command is not starting up when the computer launches. I am guessing it needs something pointing at it??

    I know the file command is good because I can double click on the new_file which has the Unix Executable File extension on it and it will launch in the terminal asking me for my password. Once I put my password in, it executes the command.

    1. What am I doing wrong other than having a real basic working knowledge of Unix?

    2. I thought by being a Unix Executable File in the System/Library/Startup folder that was enough to make it launch on Startup. How do I make it start when my computer starts up?

    3. Do I need to set something in it to work around it asking for a password to execute as it does when I double click on it and it loads into terminal asking for my password?

    4. Do I have to set a path to that file to force OS X on Boot to Initalize that Unix Executable File?

    Any help would be greatly appreciated.

    Thanks in Advance,
  2. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    The man command just brings up the manual page for the command name after it. All you have done is put the manual entry for the tcsh (C shell) into the file called new_file.

    A better way is to use the pico command which starts a simple CLI text editor which is very easy to use.

    System/Library/Startup is a Mac OS X thing. If you want to run a Unix shell script on startup you should look into launchd if I remember correctly.

    As for the password you will need to make sure it executes as root (which is not recommended for obvious reasons). It asks for a password because it is executing in your name and requires root permissions in order to run.

    A better solution might be to write a simple Applescript and then set that to run at startup. At least then you can just use the relatively simple Mac OS X GUI method for adding startup items (although it will still require a password).

Share This Page