OSX: невозможно разблокировать файл etc / paths

3212
tomas.teicher

Я хотел бы отредактировать файл / etc / paths на моем компьютере Mac.

Я новичок и пытаюсь разблокировать файл. Я попытался в терминале сделать:

etc tomasteicher$ sudo chflags nouchg /etc/paths etc tomasteicher$ open -e /etc/paths 

Почти все учебники, которые я нашел, рекомендуют это решение. Вторая команда открывает файл в TextEdit, но файл все еще заблокирован.

Кто-нибудь совет, как я могу разблокировать файл, или почему это решение не работает для этого файла?

2

1 ответ на вопрос

6
Daniel Beck

It's not actually locked, you just don't have permission to edit it. Instead, use a command-line text editor like vim to edit this file.

Use sudo vim /etc/paths to edit the file from the command line. Press i to start typing (navigate with arrow keys), press Esc when done. Then type :wq and Return


Note that in many situations, it's easier to add executable paths to a user-specific configuration file, like ~/.bash_profile, or add new files in /etc/paths.d with additional paths.

Бесполезный. Я продолжаю получать ошибки `Permission denied` при редактировании` / etc / paths` или `/ etc / paths.d / macports` с` sudo` после запуска `chflags nouch`. mcandre 6 лет назад 0