Я повредил свой .bash_profile

В ходе попытки установить что-то на моей машине MAC OSX, я думаю, что повредил свой ~/.bash_profile файл. Я отредактировал его, и внезапно, теперь, когда я открываю терминал, я ничего не могу выполнить или даже перечислить файлы:

$ ls
-bash: ls: command not found

О нет! Я пытаюсь открыть emacs для редактирования ~/.bash_profile, но я не могу:

$ emacs ~/.bash_profile
-bash: emacs: command not found
$ port install emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Computing dependencies for emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Fetching emacs
--->  Attempting to fetch emacs-23.2.tar.gz from http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Verifying checksum(s) for emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Extracting emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Configuring emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Building emacs
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Staging emacs into destroot
MacPorts running without privileges. You may be unable to complete certain actions (eg install).
--->  Installing emacs @23.2_1
Error: Target org.macports.install returned: MacPorts requires root privileges for this action
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.

Я не могу sudo, и я не могу изменить Средство поиска для показа скрытых файлов для открытия его оттуда также:

$ sudo port install emacs
-bash: sudo: command not found
$ defaults write com.apple.Finder AppleShowAllFiles YES
-bash: defaults: command not found

На помощь! Как я могу открыть ~/.bash_profile для фиксации его?

4
задан 16.07.2012, 06:21

3 ответа

Используйте полные пути для команд, пока Вы не зафиксируете Ваш PATH:

/bin/ls
/path/to/emacs

и т.д.

4
ответ дан 07.12.2019, 19:57
$ /usr/bin/vi ~/.bash_profile

... принятие Ваш HOME не повреждается также. Иначе, cd к правильному месту и редактированию.

3
ответ дан 07.12.2019, 19:57

Вы, вероятно, повредили свою переменную окружения PATH...

Используйте средство поиска для открытия файла в textwrangler или около этого.

0
ответ дан 07.12.2019, 19:57

Теги

Похожие вопросы