• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
  • About
  • Contact
  • Subscribe
  • Advertise
methodshop

methodshop

tech news, reviews & how to's

  • Trending
  • Latest
  • Tech
    • Apps
    • Internet
    • Software
    • Security
    • Games
    • Advertising
  • Life
    • Entertainment
    • TV & Film
    • Music
    • Health & Science
    • Family
    • Social Media
    • Food
    • Style
  • Learn
    • Tutorials
    • Reviews
    • News
      • Business
      • Crime
      • Politics
  • Fun
    • Featured
    • Humor
    • Holiday

Home : DIY & Tutorials : How To Make An Executable File In Terminal From A Text File (macOS/Linux)

Unix Terminal
StockSnap

How To Make An Executable File In Terminal From A Text File (macOS/Linux)

Easy tutorial that will show you how to make an executable file from a plain text document that will work in a macOS, Unix, or Linux Terminal app.

April 29, 2021 by jayfrankwilson
FacebookTweetPinLinkedIn

Did you write or modify a script in a text editor but can’t get it to execute in a Terminal program? There’s an easy solution to this common problem. Here’s how to make an executable file from a plain text file that will run in a Unix, macOS or Linux Terminal application.

In order to modify your text file, we will using the chmod command. This is a very useful Unix command used to change the permissions of files. Besides forcing stubborn files to empty from your trash can, one of the most used options for the chmod command is changing the execution rights of files.

A plain text file can be easily converted into a Unix, macOS, or Linux executable file by following the steps listed in this easy @MethodShop tutorial.
Click To Tweet

Edit Your Text File

If you are just learning how to use Unix or Linux, then you might be modifying an existing Unix executable file using a plain text editor. But as soon as you save the file, it won’t automatically open in your Terminal application anymore. Why? When you saved the file it became a text file and your operating system no longer considers it to be “executable” file.

Open Your Terminal Application

Depending on your operating system (Mac, Unix, or Linux), your Terminal application might have a different name, but regardless, the following steps will be the same.

MAC

  • The macOS already comes with a Terminal application. You can find it in your Utilities folder.
  • Macintosh HD > Applications > Utilities > Terminal

LINUX OR UNIX

  • Most Linux distributions include a Terminal application. If you don’t immediately see a Terminal icon, then try pressing Ctrl+Alt+T on your keyboard. Your Terminal application should open.
  • Another option is use the search bar. Just search for “Terminal” to see if you have a Terminal app.
  • If you can’t find your Terminal app, then download a new Linux Terminal emulator.

The chmod +x Command

Once you have a new Terminal window open, type sudo chmod +x and add a space at the end. DON’T press return yet.

chmod +x 

Drag Your Text File Into The Terminal Window

Chmod +X Command - How To Make An Executable File From A Text File For Terminal
Using the “chmod +x” command in Terminal

Next, drag the text file that you want to convert into a Unix or Linux executable file into the Terminal window. This should add the file path at the end of your chmod +x command.

sudo chmod +x /path/file-name

Press Return

Press return. After you press return, the Terminal will execute your chmod command and make your text file a Unix executable file. You should now be able to double-click on the file and have it automatically open in Terminal and execute accordingly.

If your file doesn’t automatically open in Terminal, then you might need to change the default program assigned to handle the file for your operating system.

Change The Default Open With Application (macOS)

Even if your Terminal program knows that it should execute your file, your operating system may still try to open your file in a text editor. Here’s how to make an executable Mac file that you can just double-click on and open in Terminal.

Right-Click On Your Text File And Select “Get Info”

Find your text file in the Macintosh Finder, right-click on it, and select “Get Info”.

Select Other From The “Open With” Drop-Down Menu

One of the options in the Get Info window is the “Open With” drop-down menu. Click on the drop-down menu and select “Other” at the bottom.

Macos: Change Default Application
macOS: Change Default Application

Search For The Terminal Application

In the top right corner is a search box. Type in “Terminal” in the search box and the Terminal application should appear in the search results. You will need to enable the “All Applications” option before you can click on the “Add” button.

Macos: Search All Applications For Terminal
macOS: Search All Applications For Terminal

Double-Click On Your File

Now double-click on your text file and it should automatically open in Terminal and execute properly. That wasn’t so hard, right?

How To Make An Executable File From A Text File

Unix Terminal
StockSnap

Congratulations! You did it! You now know how to make an executable file from a text file that will automatically execute in the macOS, Unix, or Linux Terminal. Give yourself a high five and grab a beer. Actually, grab us a beer too while you are at it. These tutorials don’t write themselves.

If you have any questions or comments, then please let us know in the comments.

How To Make An Executable File In Terminal From A Text File (macOS/Linux)
Click To Tweet


FacebookTweetPinLinkedIn
Category: DIY & Tutorials, Software, Technology Tag: linux, Terminal, Unix
Previous Post:Pandora On PelotonHow To Play Your Own Music On Peloton From Pandora – Easy Tutorial
Next Post:Funny Star Wars Pictures: 32 Photoshopped Pictures That Only Star Wars Fans Will Truly AppreciateCat Speeder Bikes

Reader Interactions

Comments

  1. Luke

    April 30, 2021 at 8:33 AM

    Thank you for explaining this step by step. The other tutorials online assume that we know more than we might. I appreciate you making this so easy to follow.

Leave a Reply

Your email address will not be published. Required fields are marked *

Sidebar

Popular Posts

  • Job Automation Using ChatGPT Could Make These Jobs Obsolete - Is Your Job On This List?Job Automation Using ChatGPT Could Make These Jobs Obsolete – Is Your Job On…
  • The Surprising Story Behind The NBC ChimesThe Surprising Story Behind The NBC Chimes
  • 7 Pictures Of Naked People Captured By Google's Cameras7 Pictures Of Naked People Captured By Google’s Cameras
  • 5 Funny Resurrection Jokes To Share On Easter Sunday5 Funny Resurrection Jokes To Share On Easter Sunday
  • How To Change The Default LG TV Home Screen To Live TVHow To Change The Default LG TV Home Screen To Live TV
  • 20 Famous People Who Are Members Of The Sleepless Elite20 Famous People Who Are Members Of The Sleepless Elite
  • Top 200 Nielsen DMA Rankings (2023) – Full ListTop 200 Nielsen DMA Rankings (2023) – Full List
  • Is Your Hatch Restore Already Registered? Here's How To Fix It And Unregister A Hatch Restore.Is Your Hatch Restore Already Registered? Here’s How To Fix It And…
  • The Best Caddyshack Quotes: 30 Famous Caddyshack Quotes That'll Make You LaughThe Best Caddyshack Quotes: 30 Famous Caddyshack Quotes That’ll Make You Laugh
  • 30 Dirty Irish Pick Up Lines That Will Probably Get You Slapped30 Dirty Irish Pick Up Lines That Will Probably Get You Slapped

Categories

Ask Alexa St. Patrick's Day - Funny St. Patrick's Day Jokes & Irish Jokes

10 Fun Things To Ask Alexa On St. Patrick’s Day

Amazon’s Alexa can be a fun and helpful part of your St. Patrick’s Day celebrations and activities. Here are some fun Irish and St. Patrick’s Day related things to #AskAlexa.

How To Visually Identify AI-Generated Text

How To Manually Identify AI-Generated Text Without Using A ChatGPT Detector

Wondering if what you’ve read is bot or human-generated? AI text detectors can help, but can be time-consuming. Here’s how humans can train to identify AI-generated text.

Recent Posts

  • How To Manually Identify AI-Generated Text Without Using A ChatGPT Detector
  • 10 Clever Tech Gifts That People Actually Want
  • 10 Fun Things To Ask Alexa On St. Patrick’s Day
  • 30 Dirty Irish Pick Up Lines That Will Probably Get You Slapped
  • Why Chuck E. Cheese Is Still Using Floppy Disks To Make Its Rodent Mascot Dance

Jump to comments

About

MethodShop’s mission is to entertain, inform, and sometimes gross you out. MethodShop has affiliate relationships, so we may get a small share of the revenue from your purchases. Items are sold by the retailer, not by us. All prices are subject to change.

Latest

How To Visually Identify AI-Generated Text

How To Manually Identify AI-Generated Text Without Using A ChatGPT Detector

Clever Tech Gifts

10 Clever Tech Gifts That People Actually Want

Follow

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • Pinterest
MethodShop Animated Zoom Icon
  • About
  • Submit
  • Disclaimer
  • Privacy Policy
  • Contact
  • Subscribe
  • Store

Copyright © 2023 MethodShop · All Rights Reserved