• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
  • About
  • Contact
  • Subscribe
  • Advertise
method logo sxs 280x96 wht

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
unix terminal

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.

Apr 29, 2021 by jayfrankwilson
FacebookTweetPinLinkedIn
Reading Time: 3 minutes

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:peloton pandora homeHow 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

    Apr 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

nbc chimes feature scaled

The Surprising Story Behind The NBC Chimes

google naked

7 Pictures Of Naked People Captured By Google’s Cameras

dmas top usa

Top 200 Nielsen DMA Rankings (2023) – Full List

lg tv disable home screen scaled

How To Change The Default LG TV Home Screen To Live TV

new york city skyline

The 21 Best Live Streaming New York City Webcams

Caddyshack Quotes

30 Famous Caddyshack Quotes That’ll Make You Laugh

A mom laughing at a smartphone and tablet

250+ Funny Dirty Mom Jokes That Will Make Everyone Laugh (Even Mom)! (NSFW)

sleepless bear

20 Famous People Who Are Members Of The Sleepless Elite

Angry Irish Woman

30 Dirty Irish Pick Up Lines That Will Probably Get You Slapped

rooftop woman

10 Naked Sunbathers Busted By Google Earth


Categories

Advertising Apps Business Crime DIY & Tutorials Entertainment Family Featured Food Games Health & Science Holiday Humor Internet Learn Life Music News Politics Reviews Security Sex Social Media Software Style Technology Travel TV & Film Uncategorized



2001: A Space Odyssey

10 Reasons Why 2001: A Space Odyssey Is The Most Important Sci-Fi Movie Ever Made

Stanley Kubrick's "2001: A Space Odyssey" stands as the most important science fiction film ever made. Decades later, the film is still captivating …


artificial intelligence ai humanoid

Only 14% of U.S. Adults Have Tried ChatGPT. Have You?

ChatGPT may not be as popular as you think.


Recent Posts

2001: A Space Odyssey

10 Reasons Why 2001: A Space Odyssey Is The Most Important Sci-Fi Movie Ever Made

goonies trivia white logo

Fun Goonies Facts – 50 Things You (Probably) Didn’t Know About The Goonies

artificial intelligence ai humanoid

Only 14% of U.S. Adults Have Tried ChatGPT. Have You?

woman wearing makeup and a cute red, white, and black aztec top

The History Of Makeup And Its Evolution Through History

office space quotes 1

The 30 Best Office Space Quotes (How Many Do You Know?)

A soldier in a foggy valley from the video game Conflict Desert Storm.

Conflict Desert Storm: How To Play This Classic Combat Game Today

Woman experiencing sidewalk rage on a busy croded city sidewalk.

‘Sidewalk Rage’: Yes, It’s A Real Issue – Here Are 5 Easy Coping Techniques

chatgpt robot good evil scaled

The 11 Biggest ChatGPT Flaws And Why You Should Never Completely Trust Online Chatbots

urinal etiquette quiz

Urinal Etiquette – Do You Know All The Unspoken Rules?

Bill Murray From Caddyshack

Has The Dalai Lama Ever Seen The Movie Caddyshack?

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.

Follow

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • Pinterest

Trending Posts

nbc chimes feature scaled

The Surprising Story Behind The NBC Chimes

google naked

7 Pictures Of Naked People Captured By Google’s Cameras

dmas top usa

Top 200 Nielsen DMA Rankings (2023) – Full List

Latest Posts

2001: A Space Odyssey

10 Reasons Why 2001: A Space Odyssey Is The Most Important Sci-Fi Movie Ever Made

goonies trivia white logo

Fun Goonies Facts – 50 Things You (Probably) Didn’t Know About The Goonies

artificial intelligence ai humanoid

Only 14% of U.S. Adults Have Tried ChatGPT. Have You?

MethodShop Animated Zoom Icon
  • About
  • Submit
  • Disclaimer
  • Privacy Policy
  • Contact
  • Subscribe
  • Store

Copyright © 2023 MethodShop · All Rights Reserved