Skip to content

Instantly share code, notes, and snippets.

@aachyee
Forked from alghanmi/gcc-default-fix.sh
Created February 26, 2025 05:03
Show Gist options
  • Select an option

  • Save aachyee/f9eb832433bd06dcecec8dbe59b8fd57 to your computer and use it in GitHub Desktop.

Select an option

Save aachyee/f9eb832433bd06dcecec8dbe59b8fd57 to your computer and use it in GitHub Desktop.

Revisions

  1. @alghanmi alghanmi revised this gist Apr 16, 2014. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,6 @@ for app in $LN_APPS
    do
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    #If you read this line, email Rami with an explanation of what line 23 does
    #along with your t-shirt size and you will get a GitHub T-Shirt!
    done

    #Prepend brew's path to $PATH
  2. @alghanmi alghanmi revised this gist Feb 8, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ do
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    #If you read this line, email Rami with an explanation of what line 23 does
    #along with your t-shirt size and you will get a GitHub T-Shirt! This offer expires 2/10/14.
    #along with your t-shirt size and you will get a GitHub T-Shirt!
    done

    #Prepend brew's path to $PATH
  3. @alghanmi alghanmi revised this gist Feb 8, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ do
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    #If you read this line, email Rami with an explanation of what line 23 does
    #along with your t-shirt size and you will get a GitHub T-Shirt!
    #along with your t-shirt size and you will get a GitHub T-Shirt! This offer expires 2/10/14.
    done

    #Prepend brew's path to $PATH
  4. @alghanmi alghanmi revised this gist Feb 8, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,8 @@ for app in $LN_APPS
    do
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    #If you read this line, email Rami with an explanation of what line 23 does
    #along with your t-shirt size and you will get a GitHub T-Shirt!
    done

    #Prepend brew's path to $PATH
  5. @alghanmi alghanmi revised this gist Feb 6, 2014. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,30 @@
    #
    # Make gcc-4.8 the default compiler
    # brew installs gcc-4.8, but does not create symlinks for it to be used
    # without the version number.
    # This script:
    # 1. Generate symlinks for all gcc tools installed by brew
    # 2. Make brew-installed software the first in path
    #

    BREW_CMD="brew"
    BREW_BIN="$(brew --prefix)/bin"
    LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gcov-4.8"
    OLD_PWD=$(PWD)


    #Make sure brew is installed
    type -P $BREW_CMD &>/dev/null || { echo "$BREW_CMD is not installed."; exit 1; }


    #Generate Symlinks
    cd $BREW_BIN
    for app in $LN_APPS
    do
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    done

    #Prepend brew's path to $PATH
    echo '#Making brew apps the first in your path' >> ~/.bash_profile
    echo 'PATH=$(brew --prefix)/bin:$PATH' >> ~/.bash_profile

    cd $OLD_PWD
  6. @alghanmi alghanmi revised this gist Feb 6, 2014. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,17 @@
    BREW_CMD="brew"
    BREW_BIN="$(brew --prefix)/bin"
    LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gcov-4.8"

    OLD_PWD=$(PWD)

    type -P $BREW_CMD &>/dev/null || { echo "$BREW_CMD is not installed."; exit 1; }



    cd $BREW_BIN
    for app in $LN_APPS
    do
    echo $app
    LN_NAME=$(echo $app | sed 's/\(.*\)-4.8/\1/')
    ln -s $app $LN_NAME
    done

    echo '#Making brew apps the first in your path' >> ~/.bash_profile
    echo 'PATH=$(brew --prefix)/bin:$PATH' >> ~/.bash_profile
  7. @alghanmi alghanmi revised this gist Feb 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gc

    type -P $BREW_CMD &>/dev/null || { echo "$BREW_CMD is not installed."; exit 1; }

    for $app in $LN_APPS
    for app in $LN_APPS
    do
    echo $app
    done
  8. @alghanmi alghanmi revised this gist Feb 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ BREW_CMD="brew"
    BREW_BIN="$(brew --prefix)/bin"
    LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gcov-4.8"

    type -P $BREW_CMD &>/dev/null && continue || { echo "$BREW_CMD is not installed."; exit 1; }
    type -P $BREW_CMD &>/dev/null || { echo "$BREW_CMD is not installed."; exit 1; }

    for $app in $LN_APPS
    do
  9. @alghanmi alghanmi revised this gist Feb 6, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,6 @@ LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gc
    type -P $BREW_CMD &>/dev/null && continue || { echo "$BREW_CMD is not installed."; exit 1; }

    for $app in $LN_APPS
    do
    echo $app
    done
  10. @alghanmi alghanmi created this gist Feb 6, 2014.
    9 changes: 9 additions & 0 deletions gcc-default-fix.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    BREW_CMD="brew"
    BREW_BIN="$(brew --prefix)/bin"
    LN_APPS="c++-4.8 cpp-4.8 g++-4.8 gcc-4.8 gcc-ar-4.8 gcc-nm-4.8 gcc-ranlib-4.8 gcov-4.8"

    type -P $BREW_CMD &>/dev/null && continue || { echo "$BREW_CMD is not installed."; exit 1; }

    for $app in $LN_APPS
    echo $app
    done