Setting up an Environment for Competitive Programming(CP) on Mac๐Ÿš€

Setting up an Environment for Competitive Programming(CP) on Mac๐Ÿš€

Jun 11, 2022ยท

1 min read

Play this article

Table of contents

No heading

No headings in the article.

In this environment, we will use c++ language. So, let's begin setting up by installing homebrew.๐Ÿ˜Š

Step 1 - Install homebrew

/usr/bin/ruby -e โ€œ$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step 2 - **Install gcc **

brew install gcc

Step 3 - Install gtimout

brew install coreutils

To confirm if has successfully installed gcc, type gcc-11 -v on terminal. At the time of writing this post the version of gcc is 11. After successfully installing gcc and coreutils let's now install sublime for code editor.

Step 4 - Install Sublime

https://www.sublimetext.com/download_thanks?target=mac

Step 5 - Configuring the new build system for the Sublime

  • Go to Tools > Build Systems > New Build System.

  • Copy the code from C++17.sublime-build and paste it ther and save it by any name.

  "cmd" : ["g++-11 $file_name -o $file_base_name && gtimeout 4s ./$file_base_name<inputf.in>outputf.in"], 
  "selector" : "source.c",
  "shell": true,
  "working_dir" : "$file_path"
}
  • Go to Tools > Build Systems and select your new build system.
  • Create 2 files named inputf.in and outputf.in in same directory in which you have your code.
  • Write input in inputf.in, save and run the code in sublime and you will get output in outputf.in .

Success Hope you've understood and set up the environment successfully.๐Ÿ˜Š If you've any problem, you can reach out to me via

Thanks.โค๏ธ

ย