Macos – Can’t unlock file in Mac OS

macmacosxampp

I'm trying to edit the my.cnf file in Applications/XAMPP/xamppfiles/etc but it is locked. So I tried unlocking it using

cd /Applications/XAMPP/xamppfiles/etc

sudo chflags nouchg my.cnf

But it doesn't work. I type my password and then when I open the file with the text editor it's still locked.

  • Are there any other way to unlock files?
  • Can I set the thread stack in xampp any other way than in the my.cnf file?

I'm running Mac OS 10.8.2


ls -l /Applications/XAMPP/xamppfiles/etc

drwxr-xr-x@ 16 root   admin    544 27 Feb  2010 extra
-rw-r--r--@  1 root   admin   3572 27 Feb  2010 freetds.conf
-rw-r--r--@  1 root   admin  17693 27 Feb  2010 httpd.conf
-rw-r--r--@  1 root   admin  17008 27 Feb  2010 httpd.conf.bak
-rw-r--r--@  1 root   admin    362 27 Feb  2010 locales.conf
-rw-r--r--@  1 root   admin  12958 27 Feb  2010 magic
-rw-r--r--@  1 root   admin  37486 27 Feb  2010 mime.types
-rw----rw-@  1 root   admin   2729  5 Feb 10:20 my.cnf
drwxr-xr-x@  4 root   admin    136 27 Feb  2010 openldap
lrw-r--r--   1 Oskar  admin     56 27 Feb  2010 openssl.cnf -> /Applications/xampp/xamppfiles/share/openssl/openssl.cnf
drwxr-xr-x@  4 root   admin    136 27 Feb  2010 original
-rw-r--r--@  1 root   admin   1630 27 Feb  2010 pear.conf
-rw-rw-r--@  1 root   admin  39774 27 Feb  2010 php.ini
-rw-r--r--@  1 root   admin    219 27 Feb  2010 pool.conf
-rw-r--r--@  1 root   wheel   2103 27 Feb  2010 proftpd.conf
-rw-rw-r--@  1 root   admin   1911 27 Feb  2010 proftpd.conf.orig
drwxrwxr-x@  3 root   admin    102 27 Feb  2010 ssl.crt
drwxrwxr-x@  3 root   admin    102 27 Feb  2010 ssl.key
-rw-rw-r--@  1 root   admin  23953 27 Feb  2010 webalizer.conf
-rw-r--r--@  1 root   admin  23930 27 Feb  2010 webalizer.conf.sample
drwxrwxr-x@  4 root   admin    136  5 Feb 10:20 xampp

Best Answer

When you click the Locked in the file's title bar, a menu opens. Select Unlock. It will tell you if there's a reason it fails.

Example

Fix that reason. In my example, I'm missing write permissions to the parent folder, and the editor requires those to perform atomic writes. To fix this specific error, run sudo chmod a+w /Applications/XAMPP/xamppfiles/etc, giving every account on your system write permission to that etc folder.

Alternatively, edit the file in a text editor that supports inline editing, such as vim or emacs. You'll find many tutorials on their basic use online.

Related Question