make bash the default shell for xcode?

Discussion in 'OS X Mountain Lion (10.8)' started by BerGaur, Dec 21, 2012.

  1. BerGaur macrumors regular

    BerGaur

    Joined:
    Dec 12, 2011
    Location:
    Inside my head
    #1
    I am using version 4.5.2, and when I use it to write a script it automatically has some notes and one line of code written, which isn't really a big problem, but the line of code sets the sh shell: #!/bin/sh And I prefer bash. Now, I just replace sh with bash, but I would like to set this so it will pop up with #!/bin/bash by default.

    Is there a way to do this? If so, how?
     
  2. BerGaur thread starter macrumors regular

    BerGaur

    Joined:
    Dec 12, 2011
    Location:
    Inside my head
    #2
    As I tried to find a way to do this myself, I ran into a bigger problem. It seems that if I make a script with the .tool extension, xcode doesn't show the proper text color scheme.

    So, I found a way to fix both these problems. I found a way to make my own custom templates. This will usually allow it to load with borne shell as the text color, but not every time. So I then simply made a key stroke for xcode (command+B) to set the borne shell text colors.

    I will make a video and put it on youtube to show how I made the template as soon as I can. I will update this thread as soon as the youtube video is up.
     
  3. ElectricSheep macrumors 6502

    ElectricSheep

    Joined:
    Feb 18, 2004
    Location:
    Wilmington, DE
    #3
    XCode templates are located within the XCode Application Bundle itself:

    Code:
    /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/
    
    The shell script template is under "Other". Simply change it to use the shell of your choice, and any new shell script files you create inside of XCode will use the template.
     
  4. benwiggy macrumors 68020

    Joined:
    Jun 15, 2012
    #4
    Altering the contents of application packages, particularly Apple ones, is rarely a good idea; I wouldn't be surprised if you couldn't create the same sub-folders (from Xcode/Templates downwards) in your user Library or /Library, and Xcode might still use them.
     
  5. BerGaur thread starter macrumors regular

    BerGaur

    Joined:
    Dec 12, 2011
    Location:
    Inside my head
    #5
    Video now on YouTube

    Sorry, I forgot to mention on here like I said I would. The link to my YouTube video on how I managed this is below. The video shows me making a template for python. But the same can be done for bash as well.

    I also made a custom keystroke through System Preferences > Keyboard > Applications specifically for Xcode that, with Command+B, it will set the Syntax coloring to Bourne. Just incase it glitches like it sometimes does and shows my bash script, .tool, with no syntax coloring.

    http://youtu.be/GNBjvkIOK98
     

Share This Page