echo $PATH produces this result
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Perl:/Library/Python:/Library/TeX/texbin:Vim�UnDo�:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
It appears that the non-UTF8 characters interfere with my homebrew commands. No matter which homebrew command I type I get the following:
/usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `split': invalid byte sequence in UTF-8 (ArgumentError)
I have tried to delete everything in .zshrc file. I have also tried to reinstall homebrew. None of these work. I can't even delete Homebrew to install a fresh one. I also cannot find the `Vim�UnDo�' anywhere. I suspect it has something to do with 'Vim�UnDo�'? However, any ruby script I have created works.
I manually went into my .zshrc file and removed those characters from my $PATH variable.
Related
I want to compile a 3rd party utility from its source per instructions given. I have two versions of Xcode installed. I ensured the development tools version is set properly by running sudo xcode-select -s /Applications/Development/Xcode\ 10.app/Contents/Developer and xcode-select -p returns the correct path. The version number is added to Xcode's name by me. However, every time I run make I get the error message from shell complaining about something that shouldn't be the case and I can't figure out why it accepts an incorrect path. I ran xcode-select several times with the path escaped and enclosed in quotes — no dice. Why is shell bombing make?
The error code is 127. I understand it's about white spaces, but I don't know how to tell shell escape them persistently. My guts tell me it has something to do with shell's environmental variables: I inspected COMP_WORDBREAKS and IFS but found nothing useful or I just misinterpreted. The former was just special characters not present in the path, and the latter contains tab, white space and newline characters.
I can't identify the problematic file containing the code because it's not mine. In fact, I get this error trying to compile any source code with make and make install. The dnsmasq source URL is the latest version of dnsmasq. macOS 10.14
I recently installed the Ruby Version Manager (RVM) and uninstalled it again, using this "scorched earth" script:
#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc
/etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete or comment out if this was a Per-User installation."`
(I found this script here. I also tried more milquetoast approaches such as rvm implode and rm -rf ~/.rvm, etc.)
Now
$ which rvm
returns nothing, but rvm still seems to be there in some form, because when I type
$ rvm implode
I get a reaction, specifically:
cat: /Users/lolan/.rvm/VERSION: No such file or directory
Warning! PATH is not properly set up, '/Users/lolan/.rvm/gems/ruby-2.3.1/bin' is not available. Usually this is caused by shell initialization files. Search for 'PATH=...' entries. You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'. To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'. To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
-bash: /Users/lolan/.rvm/scripts/base: No such file or directory
-bash: /Users/lolan/.rvm/scripts/functions/implode: No such file or directory
Are you SURE you wish for rvm to implode?
This will recursively remove /Users/lolan/.rvm and other rvm traces?
(anything other than 'yes' will cancel) >
Psychologist intervened, cancelling implosion, crisis avoided :)
(This time I typed return when it prompted me for 'yes'. Other times I typed 'yes'.)
Basically, I'm mystified how $ which rvm returns nothing, but $ rvm implode doesn't return "command not found". This goes contrary to what I think I understand about the command line...
Anyway, how do I really kill RVM, together with its psychologist and all? :)
PS: I'm on macOS 10.12.
==============
UPDATE: It seems that despite having gone through all the standards steps for removing RVM (see above) and despite refreshing the shell (à la source .bash_profile, source .bashrc, source .profile), the shell was still keeping some memory, somehow, of RVM, that went away when I started a brand new shell.
I'd still like to understand better how/what the shell was keeping around, because keeping bits and pieces of script folders (after the script folder in question has been deleted!?!?) seems dangerous and counterintuitive to me.
That's because rvm is in a hidden directory in your home directory and not in your PATH. which searches for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash. If it doesn't find it then it won't be returned.
If you want to know how to remove RVM there is already an answer for that. The easiest way is: rm -rf ~/.rvm
I have encountered some strange characters in Terminal's $PATH variable.
$ echo $PATH
/opt/local/bin:...(many similar entries)...:/usr/local/git/bin??n’export
??n’export is what I'm talking about. How do I remove it? I looked in .bacshrc, .bash_profile and similar files, but everything seemed normal there. Problem is that I can't install some new programs with "broken" $PATH.
I'm using bash in Terminal version 2.7.1 and macOS Sierra — Thanks in advance.
The following
perl -e 'printf q{export %s="%s";},$_,join(":",grep{-d $_&&!$seen{$_}++}split/:/,$ENV{$_}), $_ for(qw(PATH))'
will generate for you an new export PATH=..... line, but with cleaned elements. (e.g. no duplicate entries, and removed all nonexiststent directories).
you should copy and paste the result into your $HOME/.profile instead of the existing PATH line.
Problem solved. Strange entries came from /etc/profile file.
For some reason, I am getting all sorts of weird behavior in terminal, I think it's related to my $PATH variable.
If I run this command:
echo $PATH
it outputs this
/Applications/MAMP/bin/php/php5.4.10/bin:/Applications/MAMP/bin/php/php5.4.10/bin:/Applications/MAMP/bin/php/php5.4.10/bin:/Applications/MAMP/bin/php/php5.4.10/bin:/Applications/MAMP/bin/php/php5.4.10/bin...........
How do I reset it back to what it should be?
It sounds like your MAMP install has added something to your login script(s), which is adding itself to your PATH repeatedly. Check your ~/.zshrc file for suspicious lines.
I spent some time today installing Ruby, Rails and other web development stuff through homebrew and rvm. But somewhere i must have put the wrong command in the terminal since my terminal on OS X Lion (same with both standard terminal and iTerm2) now looks weird.
How do I get rid of that red tilde and black arrow and get it back how it looks as default?
As I am a beginner at terminal commands I would appreciate your help.
it seems like PS1 has been changed.
what you can do now is to change it back, or simply delete it to return to default.
in terminal, do the following:
cd ~
grep "export PS1" .*
then you will see some outputs, it might be in .profile or .bashrc, (just ignore the history one)
you can use whatever to open the file. or just open .filename in terminal, delete the line with export PS1, save, relogin. the problem shall be resolved.