why I cannot copy .pc to the /usr/lib/pkg-config folder under MacOS? - pkg-config

I am the root and use the command to copy a file to /usr/lib/pkgconfig
cp /usr/local/Cellar/eigen/3.3.4/share/pkgconfig/eigen3.pc .
Password:
cp: ./eigen3.pc: Operation not permitted
I checked the directory, root should have write permission,
drwxr-xr-x 15 root wheel 510 Apr 8 13:29 pkgconfig
How to fix this?

If you are OS X 10.11, this could be due to System Integrity Protection (SIP).
SIP - Wikipedia
Among the protected directories are: /System, /bin, /sbin, /usr (but not /usr/local).
To Disable
StackExchange article to disable SIP

Related

Homebrew error: "ruby#2.7 is not a valid keg"

Every time I try to install or uninstall something using Homebrew, I got an error below.
"Error: /usr/local/opt/ruby#2.7 is not a valid keg"
I checked symlink by typing "ls -ld /usr/local/opt /usr/local/opt/ruby#2.7", and got results below.
drwxrwxr-x 183 aiden0206 admin 5856 10 3 20:53 /usr/local/opt
lrwxr-xr-x 1 aiden0206 admin 24 10 3 20:53 /usr/local/opt/ruby#2.7 -> ../Cellar/ruby#2.7/2.7.4
There seems to be no problem. The ruby#2.7 in /usr/local/opt correctly points to the /Cellar directory. Is there any other cause of the problem?
Thank you.

cp: /usr/lib/libOpenNI.jni.dylib: Operation not permitted

I am currently trying to install OpenNi and SensorKinect drivers on my mac OS X el capitan.
I downloaded OpenNI and SensorKinect drivers and used sudo ./install.sh
and i got this:
copying shared libraries...cp: /usr/lib/libOpenNI.dylib: Operation not permitted
cp: /usr/lib/libOpenNI.jni.dylib: Operation not permitted
cp: /usr/lib/libnimCodecs.dylib: Operation not permitted
cp: /usr/lib/libnimMockNodes.dylib: Operation not permitted
cp: /usr/lib/libnimRecorder.dylib: Operation not permitted
I can't really find what the problem might be and I have already checked similar posts here.
It is a security feature of Apple's macOS operating system introduced in OS X El Capitan.System Integrity Protection.That means you can not copy file to some system folders even if by sudo command.
Still you can disable SIP, but not recommend.
The best way is to change your install.sh to copy lib files to /usr/local/lib
from
74 INSTALL_LIB=$rootfs/usr/lib
75 INSTALL_BIN=$rootfs/usr/bin
76 INSTALL_INC=$rootfs/usr/include/ni
77 INSTALL_VAR=$rootfs/var/lib/ni
78 INSTALL_JAR=$rootfs/usr/share/java
to
74 INSTALL_LIB=$rootfs/usr/local/lib
75 INSTALL_BIN=$rootfs/usr/local/bin
76 INSTALL_INC=$rootfs/usr/local/include/ni
77 INSTALL_VAR=$rootfs/var/lib/ni
78 INSTALL_JAR=$rootfs/usr/local/share/java
and I made it.

Add a locale in Mac OSX

I'm using gettext in a MAMP environment. I have locale files for es_ES, ca_ES, en_US and gl_ES. No problem with the first three, but for the forth, I get an error when trying to bind the locale translations files to the gl_ES language (galician in Spain). This is not a problem with apache or PHP because the others work (and in my CentOS server I have the gl_ES package and works fine)
So I realize my Mac OS X version 10.6.8 came without Galician support. That's strange because it has support to Spanish, Catalan and Euskera, the other three official languages in Spain. Some terminal to show you:
$ locale -a | grep _ES
ca_ES
ca_ES.ISO8859-1
ca_ES.ISO8859-15
ca_ES.UTF-8
es_ES
es_ES.ISO8859-1
es_ES.ISO8859-15
es_ES.UTF-8
eu_ES
eu_ES.ISO8859-1
eu_ES.ISO8859-15
eu_ES.UTF-8
$ ll /usr/share/locale/ | grep _ES
drwxr-xr-x 8 root wheel 272B 3 dic 2010 ca_ES/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 ca_ES.ISO8859-1/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 ca_ES.ISO8859-15/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 ca_ES.UTF-8/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 es_ES/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 es_ES.ISO8859-1/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 es_ES.ISO8859-15/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 es_ES.UTF-8/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 eu_ES/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 eu_ES.ISO8859-1/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 eu_ES.ISO8859-15/
drwxr-xr-x 8 root wheel 272B 3 dic 2010 eu_ES.UTF-8/
Regression
I tried the installation disks (adding language packs) but no success: they're just translations of the operating system.
I found this similar question, but doesn't have as much information and no good answers.
I came to localedef as an option, but it seems to be just for creating the .UTF-8 or similar when you already have the base file.
I have no clue on how to add galician support (or any other) to Mac OS X.
How to add a new locale in Mac OS X?
After literally hours of searching, pouring over perl code, and head-scratching, I have concluded at Apple is epically failing in the locale-creation-and-definition department. Here's the deal: OSX gives you a (*ehem* ...shoddy) utility script written in perl located at /usr/bin/localedef, which is SUPPOSED to create a new locale. The manpage says that usage should be something like this (run inside of usr/share/locale):
localedef -i base_file -f UTF-8 new_locale_name
As stated by the OP, this command is just for copying a current locale. Well, I couldn't even get THAT to work! I don't know perl, but I found at least one careless code error in /usr/bin/localedef (line 512 references a sub called set_escape_char which should really be set_escape) and on top of that I couldn't get localedef to work at all so that's out. As stated by #alombarte you can just copy a current locale directory with cp -R src_locale trg_locale but he forgot to mention that there are differences between the source and target locales you need to actually manually change the text files within the new locale dir.
For example, I wanted to create the locale es_NI.UTF-8 (Nicaragua), with the correct currency code and monetary info, so here's what i did:
cd /usr/share/locale
sudo cp -R es_MX.UTF-8 es_NI.UTF-8
sudo vim es_NI.UTF-8/LC_MONETARY
# changed MXN to NIO, $ to C$, etc...
# saved LC_MONETARY
You may need to change other pertinent values depending on your use of the new locale. Here is the best collection of locale info I have been able to find online. If I were a better programmer I'd make a script that takes that websites "glibc" exported format and reformats it to work with the localedef command in Mac OSX.
P.S. apologies to #alombarte for the initial downvote... even though his response does not answer the true question, I didn't realize that it would be so incredibly difficult to do it any other way.
This should do the trick:
cd /usr/share/locale
sudo cp -R es_ES gl_ES
Then open a new terminal session and list the locales again. Galician should be there :)
Looking into this found that, as of Mac OS X 10.10.3, collation is still broken for Spanish and most European languages. Collation definitions for these locales are linked to an ASCII definition. This ends up breaking things such as ORDER BY clauses on PostgreSQL.

Lilypond Mac OS X build issue

I am trying to do a clean build of Lilypond on a clean install of Mac OS X. Dependencies have been installed using Brew.
I do ./configure && make all in the Lilypond dir. It gets through the configure and starts building but ends on
ERROR: In procedure dynamic-link:
ERROR: file: "libguile-srfi-srfi-1-v-3", message: "file not found"
I know what libguile is, I don't know if it's on my system (or where it ought to be) but the configure script completes successfully and does not identify it as a missing dependency so I assume it was able to find it.
Any suggestions? Googling shows some old hints with regards to setting $LD_LIBRARY_PATH, but it seems these don't apply to Mac OS 10.6.
There is a port of lilypond available from MacPorts.
$ port info lilypond
lilypond #2.12.3, Revision 3 (textproc)
Variants: [+]docs, gui, universal
Description: Lilypond is a unix-based automated engraving system that generates beautiful sheet music from input files. Lilypond uses its
own input format, .ly, which in many ways is similar to LaTeX. Lilypond can export sheet music to PDF, EPS, SVG, and PNG
formats, and can also create MIDI files.
Homepage: http://lilypond.org/
Library Dependencies: fontforge, ghostscript, mftrace, guile, texinfo, pango, flex, urw-fonts, netpbm
Platforms: darwin
License: unknown
Maintainers: snc#macports.org, openmaintainer#macports.org
It's likely that the dynamic libraries have a .dylib extension, but need a .so extension.
I worked around this by creating links in /opt/local/lib
Owner-Users-MacBook-Pro-15:~ Carl$ ls -l /opt/local/lib | grep .so
-rwxr-xr-x 2 root admin 45152 Mar 11 12:19 libXcursor.1.dylib
-rw-r--r-- 2 root admin 50232 Mar 11 12:19 libXcursor.a
lrwxr-xr-x 1 root admin 18 Mar 11 12:19 libXcursor.dylib -> libXcursor.1.dylib
-rwxr-xr-x 2 root admin 1105 Mar 11 12:19 libXcursor.la
lrwxr-xr-x 1 root admin 32 Mar 11 21:19 libguile-srfi-srfi-1-v-3.so -> libguile-srfi-srfi-1-v-3.3.dylib
lrwxr-xr-x 1 root admin 36 Mar 11 21:19 libguile-srfi-srfi-13-14-v-3.so -> libguile-srfi-srfi-13-14-v-3.3.dylib
lrwxr-xr-x 1 root admin 32 Mar 11 21:20 libguile-srfi-srfi-4-v-3.so -> libguile-srfi-srfi-4-v-3.3.dylib
lrwxr-xr-x 1 root admin 33 Mar 11 21:20 libguile-srfi-srfi-60-v-2.so -> libguile-srfi-srfi-60-v-2.2.dylib
lrwxr-xr-x 1 root admin 17 Mar 11 21:21 libguile.so -> libguile.17.dylib
lrwxr-xr-x 1 root admin 30 Mar 11 21:22 libguilereadline-v-17.so -> libguilereadline-v-17.17.dylib
The easiest way to install Lilypond on macOS is to use lyp. Apart from installing lyp itself, which is a Ruby gem, there's no other dependency to install, no compilation step. Plus, you can install multiple versions of Lilypond and easily switch between them.
$ gem install lyp
$ lyp install lilypond
To install a specific version:
$ lyp install lilypond#2.19.53

Unable to serve pages on Mac OS X using default Apache Web Server

I have enabled the Web Server on my Mac OS X (10.5.6) by going to the System Preferences -> Internet & Network -> Sharing and clicking on the Web Server option. It gives me the IP address of my system as the Web Server, but even after clicking on it, it does not show the page, but gives an error: Failed to Connect
Any help on this would be wonderful.
I have tried with MAMP, but there, I am unable to get my own PHP pages to be displayed.
Starting and/or stopping the web server from the command line, gives me the following:
dyld: Symbol not found: _apr_socket_sendfile
Referenced from: /usr/sbin/httpd
Expected in: /usr/lib/libapr-1.0.dylib
Trace/BPT trap
The files on my box are:
~ $ ls -lrt /usr/lib/libapr*
-rwxr-xr-x 1 root wheel 578640 Sep 23 2007 /usr/lib/libapr-1.0.2.7.dylib
-rwxr-xr-x 1 root wheel 393696 Sep 23 2007 /usr/lib/libaprutil-1.0.2.7.dylib
-rwxrwxr-x 1 root admin 569544 Oct 27 10:44 /usr/lib/libaprutil-1.0.2.12.dylib
-rwxrwxr-x 1 root admin 835824 Oct 27 10:44 /usr/lib/libapr-1.0.2.12.dylib
lrwxr-xr-x 1 root admin 25 Jan 4 22:28 /usr/lib/libaprutil-1.dylib -> libaprutil-1.0.2.12.dylib
lrwxr-xr-x 1 root admin 25 Jan 4 22:28 /usr/lib/libaprutil-1.0.dylib -> libaprutil-1.0.2.12.dylib
lrwxr-xr-x 1 root admin 21 Jan 4 22:28 /usr/lib/libapr-1.dylib -> libapr-1.0.2.12.dylib
lrwxr-xr-x 1 root admin 21 Jan 4 22:28 /usr/lib/libapr-1.0.dylib -> libapr-1.0.2.12.dylib
The MD5 values are:
~ $ openssl md5 /usr/sbin/httpd /usr/lib/libapr-1.0.dylib
MD5(/usr/sbin/httpd)= d5194790e9cfaca881d0e8fc3db24889
MD5(/usr/lib/libapr-1.0.dylib)= f7f7fd3cd315ca4e7c6ad2a2f222998e
The libapr-1.0.dylib is linked to the newer 1.0.2.12 version.
I'm having a similar problem and got to this page cause I feel lucky today :)
The error means the httpd binary makes reference to a symbol that cannot be found in the appropriate dynamically linked library (libapr in this case, Apache Runtime Library)
Running same OS X version on an iMac. /usr/lib/libapr-1.0.dylib points to the most recent version of the library (1.0.2.12), which does not define the method/symbol _apr_socket_sendfile
The other version of libapr library is 1.0.2.7, does have that symbol. I had the symbolic links point to this version instead (also for libaprutil):
// BEFORE (both 1.0.2.7 and 1.0.2.12 versions exist, symlinks point to .12)
bash-3.2# ls -l libapr*
-rwxr-xr-x 2 userna wheel 835824 19 Sep 2008 libapr-1.0.2.12.dylib
-rwxr-xr-x 1 root wheel 578640 24 Sep 2007 libapr-1.0.2.7.dylib
lrwxrwxrwx 1 root wheel 21 14 Oct 2008 libapr-1.0.dylib -> libapr-1.0.2.12.dylib
lrwxrwxrwx 1 root wheel 21 14 Oct 2008 libapr-1.dylib -> libapr-1.0.2.12.dylib
-rwxr-xr-x 2 userna wheel 569544 19 Sep 2008 libaprutil-1.0.2.12.dylib
-rwxr-xr-x 1 root wheel 393696 24 Sep 2007 libaprutil-1.0.2.7.dylib
lrwxrwxrwx 1 root wheel 25 14 Oct 2008 libaprutil-1.0.dylib -> libaprutil-1.0.2.12.dylib
lrwxrwxrwx 1 root wheel 25 14 Oct 2008 libaprutil-1.dylib -> libaprutil-1.0.2.12.dylib
// CHANGE symbolic links to previous version
bash-3.2# ln -sf libapr-1.0.2.7.dylib libapr-1.0.dylib
bash-3.2# ln -sf libapr-1.0.2.7.dylib libapr-1.dylib
bash-3.2# ln -sf libaprutil-1.0.2.7.dylib libaprutil-1.0.dylib
bash-3.2# ln -sf libaprutil-1.0.2.7.dylib libaprutil-1.dylib
// TESTing whether httpd is loaded and run
bash-3.2# /usr/sbin/httpd -t
Syntax OK
Not really sure whether this has been broken since last software update that included Apache Web Server, I rarely use it on this box.
Hope it helps ;)
Jon
Maybe there are errors in the apache configuration.
If you disable the webserver in the System preferences and open a terminal you can check your configuration by typing:
httpd -t
If it gives a "Syntax OK" you're one step closer to a working webserver. Start the webserver manually by typing:
sudo httpd
If there are no errors, the webserver is started. Open a browser and check http://localhost. Sometimes an extra refresh (Command+R) is needed.
Stopping the server:
sudo httpd -k stop
If the manually starting works, but the System preferences version doesn't,
Check the /var/log/apache2/error_log for errors.
You can try to do the following:
1. backup current apache
sudo cp /usr/sbin/httpd /usr/sbin/httpd.old
2. Replace link in apache binary file to the old library:
sudo install_name_tool -change /usr/lib/libapr-1.0.dylib /usr/lib/libapr-1.0.2.7.dylib /usr/sbin/httpd
After it should work as expected and other applications will still use the new version of libapr
http://foundationphp.com/tutorials/php_leopard.php
I followed this on mine and it work perfectly.
Try to follow it a see if it works
If you're trying to access the pages from the computer itself just use http://localhost/. Also, try typing the IP address into the browser (instead of just clicking the link in the interface); don't ask me to explain why, but I've seen that make a difference.
Also make sure the OS's firewall is set to allow connections to Apache. "Personal Web Sharing" should be checked.
Have you installed the subversion 1.5 client on your machine? I am seeing the same problem and it seems to be down to this. /usr/lib/libapr-1.0.dylib is normally linked to /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libapr-1.0.2.7.dylib but if you install svn 1.5 it gets re-linked to /opt/subversion/lib/libapr-1.0.2.12.dylib.
The 1.0.2.12 version of the library does not contain the symbol _apr_socket_sendfile.
Having found the problem I'm still trying to figure out how to solve it.
Doug
Stupid question. Does libapr-1.0.dylib exist?
On my Macbook, /usr/lib/libapr-1.0.dylib is a symbolic link to libapr-1.0.2.7.dylib.
Running nm against that file does show that apr_socket_sendfile is defined in that library.
Also: do standard html pages work properly?
It sounds like either:
The httpd that comes first in your path is not /usr/sbin/httpd, and it was built strangely, or
You have installed something that overwrote either httpd or libapr.
What's the MD5 of your httpd and libapr? I get:
$ openssl md5 /usr/sbin/httpd /usr/lib/libapr-1.0.dylib
MD5(/usr/sbin/httpd)= d5194790e9cfaca881d0e8fc3db24889
MD5(/usr/lib/libapr-1.0.dylib)= f1f5ece10140a5c2cea2fece7a9e4918

Resources