Lipo working from terminal, but permission denied from bash script

2.5k views Asked by At

If I run this in a terminal (on OSX Mavericks), it works fine:

lipo -create /Release-iphoneos/libMyNewLibrary.a /Release-iphonesimulator/libMyNewLibrary.a -output /Merged/libMyNewLibrary.a

I didn't use sudo when running it in the terminal. If I add the exact same code to a bash script, I get the following error:

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't create temporary output file: /libMyNewLibrary.a.lipo (Permission denied)

The rest of the bash script works fine (generating the ios and sim libs using xcodebuild), so I'm not sure why the lipo command fails. The 2 libraries to be merged both exist prior to the lipo call being made afaik (the only post I've seen with this error suggested this may be the cause).

Is there another step that needs to be taken for lipo to work from a bash script?

1

There are 1 answers

1
A-Live On BEST ANSWER

lipo doesn't create path components for output path, check whether the directory exists and create folders otherwise.