Turbo C++ in OSX

Its been a long time since I’ve posted something in my blog. I have been super busy with all my works, studies, assignments and eventually I’ve had some time to update my blog. This is a technical guide on how to use Turbo C in OSX and not anything related to my work or gaming. I have been so accustomed to OSX that i hardly touch my PC now a days for work purpose. Its only when playing games (which is also very less as I prefer using my PS3). Mac is super smooth, I have been using it for a year now and have hardly felt any lags or hang issue while working on it, no matter how many apps i keep open in my system. The only problem I’ve faced was a low memory issue (even after having 16 GB of RAM) but i guess nothing is perfect. Mac doesn’t empty the RAM as soon as we close the app. Memory Clean app is perfect for that. Anyways, so, as I was saying, I was busy with my studies and assignments and I had to write lots of C programs to submit. Now C runs on DOS and so I started looking for a C Compiler in OSX. Unfortunately I couldn’t find any such Compiler but I was introduced to a lovely app called DOSBOX which lets u run DOS in Mac OSX. I have seen many post where people are trying to figure how to run Turbo C / C++ in OSX and they end up using terminal or xCode which is not very friendly (for this particular purpose). So this is a short guide on how to run Turbo C or Turbo C++ in Mac OSX. I will list the entire thing as I did it, so that if anyone is following this guide they will get a working copy of Turbo C / Turbo C++ installed in there Mac by the end of this tutorial.

First thing first, download a copy of Dosbox and a copy of Turbo C / Turbo C++  A quick Google search will give the official links to download this apps. Please make sure to grab the latest version of Dosbox. I am using version 0.74-1.

Once you have downloaded Turbo C and unpacked the zip archive, you will be presented with three directories called Disk 1,2 and 3. Now, make a new directory called TURBOC and copy all the files of these three directory in it. So, now u have just one directory called TURBOC with all the files in it. Copy TURBOC folder in your desktop so that its path is /Users/username/Desktop/TURBOC

If you want to Install Turbo C++ then you will be presented with three files called Tc.exe, Tc.r00, Tc.r01. Make a new directory called TC++ and put all the three files in it. Copy TC++ folder to your desktop so that its path is /Users/username/Desktop/TC++

Now install Dosbox. Once you have Dosbox installed, create another directory called DOS in your profile root folder so that its location is /Users/username/DOS  This is the folder where we will Install Turbo C / Turbo C++ and will be treated as C: when running Dosbox

Installing TURBO C

Now get ready to install Turbo C in your Mac (Installing Turbo C++ guide will follow later on in this same tutorial). Please double click the Dosbox app. I hope you all are familiar with PC terminology. In PC we have separate hdd drives called A: B: C: D: and so on (We have volumes in Mac) Where A: and B: is actually a floppy drive and C: D: etc is a Hard disk Drives. As we are aware [In-case you are not aware this will be good info for you to know 😉 ] Turbo C used to come in three floppy drives (and that’s why you had three directories when you downloaded Turbo C) So First we will have to mount A: and C: so that we can install Turbo C in our Mac. Follow along and type exactly what I am typing and you will be fine.

Once Dosbox is open, type (username will be your User Name)

mount a: /Users/username/Desktop/TURBOC

mount c: /Users/username/DOS

Please Note that there is a space before /Users

Now type

a:
INSTALL

and you will be presented with the following screen

001

Once at this screen press Enter to go to the next step, the next screen as shown below will ask for the source drive which is the one with the install files on it. The default is A which is why we have already mounted the install files directory as A: and the destination directory as C: (which is also mounted)

002

Press ENTER again

Once you have followed the previous step you should be seeing the following screen shown below, select “Install Turbo C onto a Hard Drive,” and press ENTER to go to the next step

003

Once you have selected the hard disk as destination make sure that the turbo C directory is C:\TC as shown below which should be the default.

If this is so then you should be able to press the DOWN key until “Start Installation” is selected and press ENTER

004

Now if everything has been done right the install app will begin installing Turbo C into the C:\DOS\TC directory as shown below and should complete with zero errors.

005

You should then be able to press any key to quit the install app at which point typing the following commands will show you the newly installed copy of Turbo C on your Dosbox system

cd TC
tc

006

Congratulations, if you see the above screen then you have successfully installed Turbo C onto your Dosbox emulated DOS Machine. From now on you can create your own programs which will run natively under DOS and even go so far as to compile them.

Installing TURBO C++

Please go through the “Installing Turbo C” to know in details why are we typing following command. Just follow along and make sure you type exactly what I am typing and you wont face any problem.

Once Dosbox is open, type

mount a: /Users/username/Desktop/TC++

Please Note that there is a space before /Users

After this type

a:
TC.exe

and you will be see the extraction process taking place. It will take some time so be patient until you see Done.

Now Exit Dosbox and open Finder and go to TC++ Folder in your Desktop and you will see that one separate folder is made called TC

Copy TC folder and paste it inside /Users/username/DOS

and thats it. You have Successfully Installed Turbo C++ in your Dosbox.

Auto-Mount C: on start of DOSBOX

Now we will follow some additional step to make sure whenever you launch Dosbox app, C:\ is already mounted. Otherwise you will have to manually mount C: every time you launch Dosbox.

Click on the finder icon on your Dock and then click on Go>Go to Folder in finder’s Menu Bar. Type the following path over there

/users/username/Library

You will be presented with a hidden folder which contain all the system files. Look for a folder called Preferences. In there you will see one file called DOSBox 0.74 Preferences. Open that and go tot he last line of that file.

You need to enter these three lines over there. This are the auto-executive lines and it runs as soon as you launch this app. Therefore we want this app to auto mount C: as soon as its launched. So type

mount c: /users/username/DOS
 c:/
 cls

Now Click on File>Save and Quit the app.

And thats it. Just Double Click the Dosbox App and type the following command every time you want to launch Turbo C

CD TC
tc

To launch Turbo C++ Type the following command

CD TC
CD BIN
tc

Please Note that both Turbo C or Turbo C++ Compiler has root folder called TC and IT HAS to be TC in order for them to work. So you can keep only one compiler at a time. This is a way to keep both the compilers at the same time but that is different tutorial 😛 Please let me know if anyone is interested to keep both the compilers and I will make a short tutorials on that.

Do let me know what you think about this guide. Email me or comment. It will be nice to hear from you.

Happy programming 😀

    • Yashdeep
    • May 1st, 2014

    All hail Bikash . . . !
    Man, you’re a Messiah to me! I was tired of searching this very thing on youtube and daily motion and the entire google. And, finally, after a tough work of a fortnight, I found you.
    Excellent job! Everything’s working perfect on my Mavericks-oriented iMac.
    Thanks a tonne!

  1. Thankyou. It was of great help to me…!!

  2. Can you please help me run 8086 Emulator on OSX 10.9.2.
    Thankyou in advance…!!

  3. Installed MASM6.11 for debugging of assembly language code for 8086 microprocessor in dosbox by following the same instructions as that of installing TurboC++.
    Works like a charm.
    You made my day, yet again…!!

    • Wow.. Thats great… thanks for letting me know.. U can install almost any dos based software using this method 😀

  4. This post was really helpful. Most of the things were there for initialising Turbo C / Turbo C++ on Mac OS. Thank you.

  5. This post was really helpful. Most of the things were there for initialising / initiating Turbo C / Turbo C++ on Mac OS. Thank you.

  6. Hey Bikash… this is the first commenter… i just wanted to know whether we can auto-launch c++ just like the way auto-mounted it…
    if yes, please help me by writing the command in the reply…
    Thanks in advance…!

    • Yes u can.. As it was mentioned that you need to edit “DOSBox 0.74 Preferences” file. While you are editing that add the command to it that you were writing after opening the Dosbox. for example for C++ it would be something like this..


      mount c: /users/username/DOS
      c:/
      cls
      cd tc
      cd bin
      tc

      and that’s it.. I hope you understood the point.
      Let me know if u have any questions. 😀

  7. it says illegal command INSTALL

  8. When I typed in ‘A:’ followed by ‘INSTALL’, I get ‘Illegal command’ error. By the way, I typed it without the quotes … Please help me!

    • Hi, Please make sure that you have
      a> Downloaded Turbo C / Turbo C++ and copied that in ur desktop as specified above
      b> After doing so, you have mounted both Turbo C/Turbo C++ and Dosbox and change the username in the command to your username

      If done properly you wont get any error

  9. i followed the steps exactly…am getting illegal command when i say a: install

  10. Thanx a lot, it was a peace of cake!!!

  11. thnxx a lot….i successfully installed it.
    but there is one little problem…..can u please help??
    how can i make the c++ window fullscreen??……i have tried so many times but failed
    it will be a great help if u could suggest something…!!

  12. thanks a lot!……it worked for but rather in a weird way…i tried d steps for c++ (for installing c++) but they didn’t work showing illegal command as the message.so i tried d procedure for c and it worked…(everything showing on the screen was similar but for c++ however) so its all good…i have only one issue….even after fullscreen the console window is not exactly upto the size of the monitor rather its small….is there any way to fix this?

    • Glad that it worked.. Well.. I guess it might be due to the aspect ratio or due to screen resolution.. Not exactly the dosbox issue… try changing the resolution and see, it might help..

  13. to install turbo c++,after the step a:TC.exe it is showing “Cannot create TC\BIN\AA.BAK”.Pease give me a solution

  1. No trackbacks yet.

You must be logged in to post a comment.