The posted answers attempt to workaround correct this issue by making the libraries appear where Splunk is looking for them; IMHO the "correct" solution would be to have Splunk look in the "correct" location.
Note: I am not knocking the other solutions; they've been posted for months while I ignored the problem and something good enough today is better then something perfect tomorrow. I'm just trying to explain why I am posting a new answer.
Edit: Please see the comments below about rpath; that would be the "right" way to fix it. I'll try to update my answer utilizing rpath.
Solution
Run the following command (copy and paste into a terminal -- Applications -> Utilities -> Terminal)
splunk_home="/Applications/Splunk" ; for lib in $splunk_home/bin/splunkd $(ls $splunk_home/lib/*.dylib); do for file in $(otool -L $lib | grep "/Users" | cut -d " " -f 1); do f=$(echo $file | rev | cut -d / -f 1 | rev) ; sudo install_name_tool -change $file $splunk_home/lib/$f $lib ; done ; done
Caveats
Assumes Splunk is installed in /Applications/Splunk (if not update splunk_home="..." )
Assumes you use an sh style shell (you probably do; if in doubt copy the script below into a file)
Only tested on two versions of Splunk Enterprise; they were different enough to require slight modifications so I think I've made it generic enough. If not post the version (and product if not Splunk Enterprise) and I'll try to update the answer
What does it do?
If you run otool -L <object> , it will print the shared libraries (e.g. otool -L /Applications/Splunk/bin/splunkd )
For Splunk 6.3.1 this gives us:
/Applications/Splunk/bin/splunkd:
/Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libbson-1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.5.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.2.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.28.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libxmlsec1.1.dylib (compatibility version 4.0.0, current version 4.20.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libxmlsec1-openssl.1.dylib (compatibility version 4.0.0, current version 4.20.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libarchive.13.dylib (compatibility version 15.0.0, current version 15.2.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libbz2.1.dylib (compatibility version 2.0.0, current version 2.3.0)
/Users/eserv/wrangler-2.0/build-home/ember/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
The last two libraries look good; the previous entries are looking for things in /Users/eserv/wrangler-2.0/build-home/ember/lib/ which probably doesn't exist
Note: the exact path is version specific; 6.2.3 was trying to use /Users/eserv/wrangler/build-home/6.2.3/lib/
For each library, you then need to run install_name_tool to correct the path:
install_name_tool -change /Users/eserv/wrangler/build-home/6.2.3/lib/libmongoc-1.0.0.dylib /Applications/Splunk/lib/libmongoc-1.0.0.dylib /Applications/Splunk/bin/splunkd
After running similar commands 12 times, you'd try to start Splunk only to discover /Applications/Splunk/lib/libmongoc-1.0.0.dylib references /Users/eserv/wrangler/build-home/6.2.3/lib/libbson-1.0.0.dylib . To put an end to the rabbit hole, I just looped over all libraries in /Applications/Splunk/lib
At this point, my laziness kicked in and I wrote a script:
#!/bin/sh
splunk_home="/Applications/Splunk"
for lib in $splunk_home/bin/splunkd $(ls $splunk_home/lib/*.dylib); do
for file in $(otool -L $lib | grep "/Users" | cut -d " " -f 1); do
f=$(echo $file | rev | cut -d / -f 1 | rev)
sudo install_name_tool -change $file $splunk_home/lib/$f $lib
done
done
Save it to a file, make it executable, and execute it.
Note: The command at the top of this post is just a minimized version of this script
... View more