This lab is for those who are installing PyCharm on Mac machines.
Download PyCharm.
Locate the downloaded .dmg
file and click to open. Drag PyCharm into the Applications folder.
Open your Finder, select Applications, then PyCharm.
You may wish to pin PyCharm to your dock after launching.
sudo nano /usr/local/bin/pycharm
#!/bin/sh
open -na "PyCharm.app" --args "$@"
sudo chmod +x /usr/local/bin/pycharm
You will now be able to type pycharm .
in the Terminal to open PyCharm to edit the current directory’s contents.
We are going to create a sample project directory using the Terminal, then open PyCharm and edit files in that directory. A video follows the steps.
cd ~ # make sure in your home directory
mkdir seng-201 # This directory will hold all our code for the course
cd seng-201 # change to the new directory
mkdir pycharm-test # Make a new subdirectory for a test project.
cd pycharm-test # change into the subdirectory
pycharm . # launch PyCharm in the current directory
pycharm
command launches the PyCharm program. The command pycharm .
says launch Pycharm and have it open the current working directory. The symbol .
always means the working directory. Sometimes it will be necessary to explicitly tell the CLI we are referring to the working directory; more on those situations as they arise.Here is the process in a video:
Let’s create a file in the Terminal in our project directory. We should see it immediately in PyCharm.
pycharm-test
directory.touch hello.py
to create an empty Python file.hello.py
in the directory here. Click on it and it will open an empty editor pane.print("Hello World")
.cat hello.py
. You should see the code.So you now have PyCharm successfully editing files and interacting with directories on Mac.
You are now ready to code! Move on to PyCharm Basics lab.