I'm trying to start learning Swift and when I use the terminal line

$ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

it gives me

-bash: $: command not found

What should I do? I have literally no experience with Terminal and just following the steps from Installing Swift.

  • 2
    Don't type the $- dollar sign before export.
    – fd0
    Jul 3, 2017 at 14:14
  • To elaborate on that, the dollar sign is a convention to represent the command prompt that you see in the Terminal to the left of the flashing cursor, before you've typed anything. So you're only supposed to type whatever is printed after that. Depending on your exact configuration, the prompt you actually see in the terminal may be a "$", or a ">", some other text (e.g. your username, or your Mac's hostname, or the current directory) followed by a "$", or something completely different.
    – calum_b
    Jul 3, 2017 at 14:18
  • Swift is automatically installed if you have/install Xcode. If that is your case, check first the command "which swift" in Terminal. Suggest to use Xcode and playgrounds first, easier until get experienced with Terminal
    – Yoan
    Jul 3, 2017 at 14:54

2 Answers 2


$ represents the standard shell prompt and is usually used to show that the commands need to be entered in Terminal. So you only need to enter the part starting with export.


I would step back from bash and terminal if the primary goal is learning swift. You don't need to get to the repl in terminal and I would argue - if you have an iPad, you should start there instead of Xcode.

If you want to (or have to) start on the Mac - open Xcode from the App Store and then make a new playground - save it to your desktop and you should have a window that looks like this to start coding without needing bash or the more detailed setup page you linked to.

hello world playground in Xcode

The help for playgrounds should get you going - it's much easier to open the help in the app, but it's also available on the web.

There's a time to learn bash and terminal and maybe that's your end goal, but reading your post I'd rather point you to the applications designed to remove all the plumbing, patching, command line configuration and get you playing with the actual code and learning swift.

  • thank you everyone for your answers but i have another question: should i also omit the $ in the "${PATH}" part also?
    – mutucan
    Jul 4, 2017 at 7:37
  • @mutucan one question per question is best. Why not form your next one and post. A link here help if nay backstory here illustrates the new post. Just be sure the new question can stand alone with pertinent details.
    – bmike
    Jul 4, 2017 at 10:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .