How to Set Up Cypress.io on Mac

A guide for installing Cypress on MacOS.

Hales
Software Testing Pipeline
3 min readJan 2, 2023

--

A software tester’s screen showing code.
Photo by Karl Pawlowicz on Unsplash

The first step of a new project can be the most intimidating. If you’re about to make the switch to Cypress, don’t worry. Cypress is quicker to install and get up and running than Selenium.

In this article, I’ll walk you through how to install Cypress.io for the first time on a Mac.

Step 1 — Verify that your OS is up to date

A screenshot of the MacOS update screen.
Update your business. Screenshot by author.

Before installing Cypress, verify that your computer does not require any software updates. By taking this step you make sure that your computer is up to date prior to trying to install new packages that may have dependencies.

Do this by clicking on the apple icon in the upper left corner of the screen > System Preferences > Software Update.

Step 2 — Install Cypress

Open a terminal window and run the following command to install the Cypress CLI (command-line interface): npm install -g cypress

Note: To set up Cypress on a Mac, you will need to have Node.js and npm (the Node.js package manager) installed on your computer.

Step 3— Create a folder for your project

Navigate to the directory where you want to install Cypress. For example, you can create a new directory and navigate to it:

mkdir my-project

cd my-project

Command line commands to create a new directory on MacOS for software testers.
Screenshot by author.

Step 4 — Run Cypress

From within the newly created directory, run the following command to initialize a new Cypress project: cypress open

A screenshot of the command line for how to run cypress.io on MacOS.
Screenshot by author.

This will create a new directory called cypress in your project, and open the Cypress Test Runner in a new window.

  1. In the Cypress Test Runner, you can click on the examples folder to see some sample test files. You can use these as a starting point for writing your own tests.
  2. To create a new test file, click on the Add new test button in the Test Runner. This will create a new test file in the cypress/integration directory. You can write your test code using JavaScript and the Cypress API.
  3. To run your tests, click on the Run all tests button in the Test Runner. This will execute all of the test files in the cypress/integration directory.

I hope this helps! Let me know if you have any questions.

  1. Update OS
  2. Create a local folder for your Cypress project
  3. Install Cypress with npm install cypress --save-dev from within the newly created folder
  4. From within the newly created directory, run the following command to initialize a new Cypress project: cypress open

Not a Medium member? Use this link to join. You’ll get access to more Medium content, and help to support articles like this.

Was this article helpful? Buy me a coffee.

--

--

Software Testing Pipeline
Software Testing Pipeline

Published in Software Testing Pipeline

Tech has a pipeline problem. We’re here to reduce the hurdles for people who want to start a career in tech. Learn about software testing and software quality assurance.

Hales
Hales

Written by Hales

QA Engineer. Nerd Extraordinaire. Lover of opossums.

No responses yet