Open In App
Related Articles

C++ Installation on MacBook M1 for VS Code

Improve Article
Save Article
Like Article

This article is written on CPP installation for the latest  MacBook M1 processor. It’s not like we can’t do CPP programming in the latest MacBook, there is Xcode which is a substitute for other code editors. But still many of the developers like to code on Visual Studio.

So let’s start with this installation of CPP on Visual Studio code.

After downloading Visual Studio Code or Visual Studio Code Insiders open it and go to extensions. There is a search tab, just type c++ then click on 1 recommendation and install it. Another extension you have to download is code runner.

During this process, users can come across 2 different types of issues. So let’s discuss what they are and how to resolve them.

Problem 1: After downloading all extensions on VS Code not able to work on CPP.

Follow the below steps to resolve the same issue:

  • Step 1: Open your terminal and run the below command:
arch -x86_64 /bin/bash -c "$(curl -fsSL  Homebrew/install/master/"
  • Step 2: Now after the completion of the previous command type : 
arch -x86_64 brew install mingw-w64

Problem 2: #include<bits/stdc++.h> is not found .

If you want to more about the system header file click here. Follow the below steps to resolve the issue:

  • Step 1: Open terminal using command+space and type terminal.
  • Step 2: Now move to the below-given path :

  • Step 3: Now create bits directory in the present location
mkdir bits

  • Step 4: Now move into bits directory and create a file and name it  stdc++.h.
nano stdc++.h
  • Step 5: After creating a file just copy the code from the GitHub repository and paste that code into stdc++.h file and then press
 {control+x}-> y -> return

Now just try to implement any CPP code to ensure that you are done with the CPP setup on MacBook M1.


#include <bits/stdc++.h>
using namespace std;
int main()
    int a= 2, b=4;
    return 0;

That’s it. You have successfully installed CPP into your Mac M1.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 12 Mar, 2021
Like Article
Save Article
Similar Reads