1

I would like to create a script to install a group of programs. The PKG files reside on a Windows file share.

I current can install them one at a time through the Terminal using the following syntax:

sudo installer -store -pkg "/Volumes/{Path to package}" -target /

But when I try to include this into my installer.sh script I get a syntax error that part of the path contained in quotes is an invalid option. It seems that the double quotes around my path are not being included when passed into the shell.

So I tried escaping the quotes by adding a \ in front of each double quote and I get the same error. Am I supposed to escape my quotes some other way?

installer -store -pkg “/Volumes/ChiefGeneral/TechGeneral/Misc/Batch Install/X6/Chief Architect Premier X6.pkg” -target /
installer -store -pkg “/Volumes/ChiefGeneral/TechGeneral/Misc/Batch Install/X6/Chief Architect Interiors X6.pkg” -target /
installer -store -pkg “/Volumes/ChiefGeneral/TechGeneral/Misc/Batch Install/X6/Chief Architect Lite X6.pkg” -target /

Thank you.

  • 1
    Presumably you'll need to be root to run the script, so can yo u 1) remove the sudo from the command in the shell script and 2) run it as sudo installer.sh? Not sure that there will be any change in behavior, but let's see. Finally, it may be helpful if you can publish the install.sh script you're building. – webmarc Sep 17 '14 at 16:44
  • Thanks for the script, can you put it into your question? The formatting is lost in the comments. – webmarc Sep 17 '14 at 18:40
2

Is it possible that the editor you are using to create the script is using "smartquotes" instead of regular double quotes, and so it's not treating the quoted material as a single parameter?

Try getting rid of the quotes and escaping the spaces with \ and see if that works. If it does, then make sure you're using a plain old text editor that won't mess with your quotes.

| improve this answer | |
  • Thank you! That must have been the problem. I used TextEdit to write it at first but I just rewrote it using Text Wrangler and it's working perfectly! – KCCLEMO Sep 22 '14 at 13:38
1

Programmatically installing apps on OS X has, traditionally, been a bit of a pain. However, I stumbled across this Homebrew-equivalent for Apps a few weeks ago and am loving it: Homebrew Cask. I was already a Homebrew fan for command line app and package management and Cask task it's same, simple command line and applies to fetching and installing Applications on my OS X machines.

If you already have Homebrew, getting Cask is simple:

brew install caskroom/cask/brew-cask

Now I can use the cask command to install Applications. It does the same symlink-managed sharing philosophy brew does for managing things. Let's say I wanted Google Chrome:

brew cask install google-chrome

and I've got it.

To see a list of Applications available for install with cask do:

brew cask search

You can now script Application installation with relative ease. Even if a system doesn't have brew on it, you can just add a check-and-install section to your script to set it up on first run.

| improve this answer | |

You must log in to answer this question.

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