19

I'm trying to install TBB (Thread Building Blocks) from Intel onto my Mac. However, no matter where I look, I can't find the .profile file that I require to modify to use TBB.

Any advice or hints on where I could find it?

If it's hidden, how can I unhide it? (I'm new to OS X)

I have read some articles that say I could make my own .profile file but I don't think it's what I need to install the TBB.

slhck
  • 223,558
  • 70
  • 607
  • 592
Rommel Alonzo
  • 193
  • 1
  • 1
  • 4

1 Answers1

28

There is no ~/.profile by default.

Some background: when you start your Terminal.app, it loads a shell – in your case Bash. Shells can have configuration files, and .profile is one of these. They are read when the shell starts up, in a specific order. You can run man bash and read the section "Invocation" for more details.

Now, under macOS, I would recommend to not create a .profile file, but a .bash_profile file instead. For Bash, this will make no difference in functionality. Note however that once you create a file called ~/.bash_profile, your ~/.profile will not be read anymore, and since most guides will want you to modify .bash_profile, it's better to stick to this one.

You can simply create the file if it doesn't exist and open it in a text editor.

touch ~/.bash_profile
open -e !$

Save it, and the next time you start a new instance of Bash (e.g. by opening a new Terminal window), your ~/.bash_profile will be read and all commands therein will be executed.

slhck
  • 223,558
  • 70
  • 607
  • 592
  • I tried this but got a syntax error message, with a pointer at the "~", any suggestions? – Stuart Jeckel Nov 17 '15 at 20:26
  • @StuartJeckel What error exactly? There shouldn't be a problem with this.. are you sure you've copy-pasted exactly as shown? – slhck Nov 18 '15 at 10:00
  • 1
    The .bash_profile note is very important here – chrismarx Jun 18 '18 at 18:04
  • 1
    @chrismarx You're right, I actually rewrote the answer to tell users to just go ahead and create a `.bash_profile` instead of a `.profile`. – slhck Jun 19 '18 at 05:50
  • @slhck thanks! I set my $NPM_TOKEN in this bash file but `echo $NPM_TOKEN` shows nothing still. (trying to permanently set it system wide) – Ben Racicot Aug 09 '18 at 13:19
  • 1
    @BenRacicot Your `.bash_profile` is not automatically read system-wide, only when you actually start Bash through your terminal. It depends on your operating system and what other files you have. Perhaps you should ask a new question and give us some more details (and maybe try putting `echo` statements in the files to see which are being loaded). – slhck Aug 09 '18 at 13:47