Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

El Capitan version? #30

Closed
femmebot opened this issue Oct 21, 2015 · 26 comments
Closed

El Capitan version? #30

femmebot opened this issue Oct 21, 2015 · 26 comments

Comments

@femmebot
Copy link

Is there a version for El Capitan? I tried to run it to see if it would work anyway but it failed :(

@afeld
Copy link
Contributor

afeld commented Oct 21, 2015

Can you give more details about the issue you experienced?

@femmebot
Copy link
Author

Sure. I can send you the log file

@femmebot
Copy link
Author

Sorry this is piecemeal but I'm only allowed to attach images.
screen shot 2015-10-22 at 12 50 25 pm
screen shot 2015-10-22 at 12 50 47 pm
screen shot 2015-10-22 at 12 51 04 pm

@femmebot femmebot reopened this Oct 22, 2015
@monfresh
Copy link
Contributor

Thanks, those images are very helpful. It looks like the issue is with PhantomJS, which does not yet work on El Capitan. They are working on a new release, but in the meantime, I'll detect if El Capitan is running, and if so, disable phantomjs.

@femmebot
Copy link
Author

Thanks. It also seemed to have changed my username in terminal from phoebeespiritu to C02PT3MUFVH8%. Is that normal?

@monfresh
Copy link
Contributor

No, that is not normal. The script does not make such changes. Could you please try quitting and relaunching your Terminal, and/or restarting your computer?

@femmebot
Copy link
Author

Just rebooted and it still has the crazy username although it's now all lowercase.

@monfresh
Copy link
Contributor

Is the username different everywhere on your computer (i.e when you log in, in your Finder), or just in Terminal?

@femmebot
Copy link
Author

Nope, just in Terminal. Very weird.

On Mon, Oct 26, 2015 at 10:27 AM, Moncef Belyamani <notifications@github.com

wrote:

Is the username different everywhere on your computer (i.e when you log
in, in your Finder), or just in Terminal?


Reply to this email directly or view it on GitHub
#30 (comment).

@monfresh
Copy link
Contributor

What is the output of whoami in the Terminal?

@monfresh
Copy link
Contributor

Also, can you copy and paste the contents of your .zshrc, .bashrc and .bash_profile? They should be in your home folder. You can print the contents like this: cat ~/.zshrc.

@femmebot
Copy link
Author

whoami

phoebeespiritu

.zshrc

export PATH="$HOME/.bin:$PATH"

.bash_profile

# Environment Variables
# =====================
  # Library Paths
  # These variables tell your shell where they can find certain
  # required libraries so other programs can reliably call the variable name
  # instead of a hardcoded path.

    # NODE_PATH
    # Node Path from Homebrew I believe
    export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"

    # Those NODE & Python Paths won't break anything even if you
    # don't have NODE or Python installed. Eventually you will and
    # then you don't have to update your bash_profile

  # Configurations

    # GIT_MERGE_AUTO_EDIT
    # This variable configures git to not require a message when you merge.
    export GIT_MERGE_AUTOEDIT='no'

    # Editors
    # Tells your shell that when a program requires various editors, use sublime.
    # The -w flag tells your shell to wait until sublime exits
    export VISUAL="subl -w"
    export SVN_EDITOR="subl -w"
    export GIT_EDITOR="subl -w"
    export EDITOR="subl -w"

  # Paths

    # The USR_PATHS variable will just store all relevant /usr paths for easier usage
    # Each path is seperate via a : and we always use absolute paths.

    # A bit about the /usr directory
    # The /usr directory is a convention from linux that creates a common place to put
    # files and executables that the entire system needs access too. It tries to be user
    # independent, so whichever user is logged in should have permissions to the /usr directory.
    # We call that /usr/local. Within /usr/local, there is a bin directory for actually
    # storing the binaries (programs) that our system would want.
    # Also, Homebrew adopts this convention so things installed via Homebrew
    # get symlinked into /usr/local
    export USR_PATHS="/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin"

    # Hint: You can interpolate a variable into a string by using the $VARIABLE notation as below.

    # We build our final PATH by combining the variables defined above
    # along with any previous values in the PATH variable.

    # Our PATH variable is special and very important. Whenever we type a command into our shell,
    # it will try to find that command within a directory that is defined in our PATH.
    # Read http://blog.seldomatt.com/blog/2012/10/08/bash-and-the-one-true-path/ for more on that.
    export PATH="$USR_PATHS:$PATH"

    # If you go into your shell and type: $PATH you will see the output of your current path.
    # For example, mine is:
    # /Users/avi/.rvm/gems/ruby-1.9.3-p392/bin:/Users/avi/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/avi/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/avi/.rvm/bin:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/mysql/bin:/usr/local/share/python:/bin:/usr/sbin:/sbin:

# Helpful Functions
# =====================

# A function to CD into the desktop from anywhere
# so you just type desktop.
# HINT: It uses the built in USER variable to know your OS X username

# USE: desktop
#      desktop subfolder
function desktop {
  cd /Users/$USER/Desktop/$@
}

# A function to easily grep for a matching process
# USE: psg postgres
function psg {
  FIRST=`echo $1 | sed -e 's/^\(.\).*/\1/'`
  REST=`echo $1 | sed -e 's/^.\(.*\)/\1/'`
  ps aux | grep "[$FIRST]$REST"
}

# A function to extract correctly any archive based on extension
# USE: extract imazip.zip
#      extract imatar.tar
function extract () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)  tar xjf $1      ;;
            *.tar.gz)   tar xzf $1      ;;
            *.bz2)      bunzip2 $1      ;;
            *.rar)      rar x $1        ;;
            *.gz)       gunzip $1       ;;
            *.tar)      tar xf $1       ;;
            *.tbz2)     tar xjf $1      ;;
            *.tgz)      tar xzf $1      ;;
            *.zip)      unzip $1        ;;
            *.Z)        uncompress $1   ;;
            *)          echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

# Aliases
# =====================
  # LS
  alias l='ls -lah'

  # Git
  alias gst="git status"
  alias gl="git pull"
  alias gp="git push"
  alias gd="git diff | mate"
  alias gc="git commit -v"
  alias gca="git commit -v -a"
  alias gb="git branch"
  alias gba="git branch -a"
  alias gcam="git commit -am"
  alias gbb="git branch -b"


# Case-Insensitive Auto Completion
  bind "set completion-ignore-case on"

# Final Configurations and Plugins
# =====================
  # Git Bash Completion
  # Will activate bash git completion if installed
  # via homebrew
  if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
  fi

  # RVM
  # Mandatory loading of RVM into the shell
  # This must be the last line of your bash_profile always
  [[ -s "/Users/$USER/.rvm/scripts/rvm" ]] && source "/Users/$USER/.rvm/scripts/rvm"  # This loads RVM into a shell session.


# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

No .bashrc file

@monfresh
Copy link
Contributor

Since whoami worked, it sounds like a shell issue to me. It looks like you have a custom .bash_profile, and although I don't see anything in there that would change your prompt, my guess is that your bash config is causing this. What happens if you change your shell to zsh?

chsh -s "$(which zsh)"

@femmebot
Copy link
Author

I tried chsh -s "$(which zsh)". Here's what I got:

chsh: no changes made

Yup, I had removed the .bash_profile to see if that was causing it but didn't seem to do anything.

@monfresh
Copy link
Contributor

That's strange. It should prompt you to enter your password. Did you make any changes to your laptop before you ran the script?

@femmebot
Copy link
Author

Oh, sorry. It did prompt me for my password. After I entered my password, I got

chsh: no changes made

I added the following .bash_profile prior to running the script:

# Case-Insensitive Auto Completion
  bind "set completion-ignore-case on"

# Final Configurations and Plugins
# =====================
  # Git Bash Completion
  # Will activate bash git completion if installed
  # via homebrew
  if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
  fi

Also, I had a curious issue one day (the day after I did added .bash_profile) whereby Terminal wouldn't allow me to type or paste in the letter 'o'. It would beep every time I tried to type an 'o'. When I tried to paste in a string that contained Os, it would strip out the O and beeped for every O it removed.

@monfresh
Copy link
Contributor

Very strange. I wonder if GSA IT made some changes that would cause this.
Perhaps no shell changes were made because you are already using zsh? What does echo $SHELL say?

@femmebot
Copy link
Author

Got this from echo $SHELL

/bin/zsh

@monfresh
Copy link
Contributor

ok, that makes sense. Do you have a .zprofile, .profile, or .zlogin?

@femmebot
Copy link
Author

.zprofile, .profile or .zlogin

none of the above

@monfresh
Copy link
Contributor

I think I understand what's going on. By default, the zsh prompt will not show you your username or your current directory. It just displays your computer's name, followed by a percent sign. I've been meaning to add a line to .zshrc so that it customizes your prompt to be more like the default bash prompt.

Can you try adding the following to your .zshrc, then quit and restart Terminal?

precmd () { PS1="%{%F{166}%}[%~] %{%F{65}%}$(rvm-prompt) %{%f%}$ " }

@femmebot
Copy link
Author

Okay, I added to .zshrc, restarted and got this:

precmd: command not found: rvm-prompt                                           
[~]  $ 

@monfresh
Copy link
Contributor

Right. Because the script never completed.

Please try the following:

curl --remote-name https://raw.githubusercontent.com/18F/laptop/master/mac

Open the mac file wherever you downloaded it.
Comment out line 158 (brew_install_or_upgrade 'phantomjs')
Add the following line around line 222 (before brew_tap 'pivotal/tap'):

append_to_file "$HOME/.zshrc" 'precmd () { PS1="%{%F{166}%}[$(whoami)][%~] %{%F{65}%}$(rvm-prompt) %{%f%}$ " }'

Save the file.

bash mac 2>&1 | tee ~/laptop.log

The script should now complete, and when you quit and restart Terminal (or open a new tab), your prompt should look something like this:

[your username in orange] [your current directory in orange] your current ruby version in green $

You can then customize your prompt the way you like it by modifying that precmd line. If you want to use different colors, replace 166 and 65 in that line with any of the possible 256 Xterm colors:
https://upload.wikimedia.org/wikipedia/commons/9/95/Xterm_color_chart.png

@monfresh
Copy link
Contributor

Alternatively, you can try out a bunch of different themes by installing oh-my-zsh. If you do go that route, you'll first need to make a backup of your final .zshrc that the script produces and paste in the contents (except for the precmd line) at the end of the new .zshrc that oh-my-zsh creates.

It's on my to-do list to create a tutorial for customizing your prompt.

@femmebot
Copy link
Author

When I run any command, I keep getting precmd: command not found: rvm-prompt at the end.

@femmebot
Copy link
Author

Yay, finally finished the installation. Terminal prompt looks like what you described:

[your username in orange] [your current directory in orange] your current ruby version in green $

phew!

@afeld afeld closed this as completed in #33 Oct 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants