Can't unlock file in Mac OS

11,844

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.

Share:
11,844

Related videos on Youtube

Иван Светушков
Author by

Иван Светушков

Know some code here and there. Python, PHP, MySQL, Lua, Java, HTML, CSS, Javascript.

Updated on September 18, 2022

Comments

  • Иван Светушков
    Иван Светушков over 1 year

    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
    
    • HikeMike
      HikeMike about 11 years
      What do you mean by "locked"? Are you sure it's not just insufficient permissions of the text editor? What error is displayed?
    • Иван Светушков
      Иван Светушков about 11 years
      I get no error. In the text editor it says locked at the top. I have write and read - permissions
    • HikeMike
      HikeMike about 11 years
      Can you edit (and save) the file with a command-line text editor like vim or emacs? What are the permissions for the folder? Could you provide the output of ls -l /Applications/XAMPP/xamppfiles/etc?
    • Иван Светушков
      Иван Светушков about 11 years
      How would I edit it using emacs?
  • HikeMike
    HikeMike about 11 years
    @Oskwish Updated answer.
  • Иван Светушков
    Иван Светушков about 11 years
    Now mysql/phpmyadmin gives me this error: #1 - Can't create/write to file '/var/folders/cm/bvzmj0451s1863p1g1n72j900000gq/T/#sql555_4_‌​2.MYI' (Errcode: 13)
  • HikeMike
    HikeMike about 11 years
    @Oskwish When you saved the file, the ownership and permissions were probably changed. You should change these to match what was there previously, just to be sure. Depending on what exactly you changed in the file, this could be a result of those changes as well.
  • Иван Светушков
    Иван Светушков about 11 years
    Fixed the new error with sudo chmod 600 my.cnf