install_name_tool: can't open input file: *.dylib for writing (Permission denied)

649 Views Asked by At

I can clearly see that libopenvdb.dylib file exists and I'm the owner. But install_name_tool throws this error:

install_name_tool: can't open input file: libopenvdb.dylib for writing (Permission denied)

Terminal commands:

aec@mojaves-Mac Frameworks % pwd
/Users/aec/Documents/myapp-mac/myapp.app/Contents/Frameworks
aec@mojaves-Mac Frameworks % ls -lh libopenvdb.dylib
-r--r--r--  1 aec  staff   3.7M May  1 00:03 libopenvdb.dylib
aec@mojaves-Mac Frameworks % install_name_tool -change /usr/local/opt/boost/lib/libboost_iostreams-mt.dylib  @rpath/libboost_iostreams-mt.dylib libopenvdb.dylib
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open input file: libopenvdb.dylib for writing (Permission denied)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't lseek to offset: 0 in file: libopenvdb.dylib for writing (Bad file descriptor)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't write new headers in file: libopenvdb.dylib (Bad file descriptor)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't close written on input file: libopenvdb.dylib (Bad file descriptor)
aec@mojaves-Mac Frameworks %

What could be the cause? I couldn't figure out.

Screenshot

1

There are 1 best solutions below

0
On

As commented by @Siguza seems like the problem is due to write permission. Not tested yet.

% ls -lh libopenvdb.dylib
-r--r--r--  1 aec  staff   3.7M May  1 00:03 libopenvdb.dylib

Notice -r--r--r--