Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7913725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:54:41+00:00 2026-06-03T13:54:41+00:00

Trying to get Amazon’s EC2 command line tools to work. This is what my

  • 0

Trying to get Amazon’s EC2 command line tools to work. This is what my .bash_profile looks like. I get the error: /users/zmjones/.ec2/bin/ec2-add-keypair: /usr/bin/env: bad interpreter: Operation not permitted

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:$PATH
PATH=/opt/local/sbin:/usr/local/bin:/usr/x11/bin:/usr/texbin:$PATH
PATH=/usr/local/texlive/2011/bin/x86_64-darwin:$PATH
PATH=/Library/Frameworks/EPD64.framework/Versions/Current/bin:$PATH
EC2_HOME=~/.ec2
PATH=$PATH:$EC2_HOME/bin
EC2_PRIVATE_KEY=`ls $EC2_HOME/pk-*.pem`
EC2_CERT=`ls $EC2_HOME/cert-*.pem`
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/

export PATH

Does anybody see anything wrong with this? I am not sure what I doing wrong.

Output of ls -l /usr/bin/env

-r-xr-xr-x  1 root  wheel  34720 Sep  8  2011 /usr/bin/env
zmjones-mbp:.ec2 zmjones$ /usr/bin/env
TERM_PROGRAM=iTerm.app
TERM=xterm
SHELL=/bin/bash
TMPDIR=/var/folders/x3/vrw5029d1rj9xblj8bmxl0m00000gn/T/ 
Apple_PubSub_Socket_Render=/tmp/launch-91y0bp/Render
OLDPWD=/Users/zmjones
USER=zmjones
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-H3JJsl/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
Apple_Ubiquity_Message=/tmp/launch-n2bT2X/Apple_Ubiquity_Message
PATH=/users/zmjones/.ec2/bin:/Library/Frameworks/EPD64.framework/Versions/Current/bin:/usr/local/texlive/2011/bin/x86_64-darwin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/x11/bin:/usr/texbn
PWD=/Users/zmjones/.ec2
 JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
LANG=en_US.UTF-8
ITERM_PROFILE=Default
SHLVL=1
HOME=/Users/zmjones
ITERM_SESSION_ID=w0t0p0
LOGNAME=zmjones
EC2_PRIVATE_KEY=pk-mykey.pem
DISPLAY=/tmp/launch-6kkP5t/org.x:0
EC2_CERT=cert-mycert.pem
 _=/usr/bin/env

Partial solution: tr -d '\r' < /users/zmjones/.ec2/bin/ec2-add-keypair > /users/zmjones/.ec2/bin/ec2-add-keypair

This seems to allow the commands to execute, but they now don’t work. For example, I downloaded a new copy of the ec2 api tools, put them in ~/.ec2 tried ec2-describe-images -o amazon and got the bad interpreter error. I renamed ec2-describe-images to ec2-describe-images.bak ran the tr command listed above and tried it again. I then receive a permission denied error. When I run it with sudo it tells me that EC2_HOME isn’t set, but echo $EC2_HOME indicates that it is. I ran chmod +x ec2-describe-images and now I am back to the same bad interepreter error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:54:42+00:00Added an answer on June 3, 2026 at 1:54 pm

    /users/zmjones/.ec2/bin/ec2-add-keypair has DOS line-endings.

    To fix:

    mv /users/zmjones/.ec2/bin/ec2-add-keypair /users/zmjones/.ec2/bin/ec2-add-keypair.bak
    tr -d '\r' < /users/zmjones/.ec2/bin/ec2-add-keypair.bak > /users/zmjones/.ec2/bin/ec2-add-keypair
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
I'm trying to get started with Amazon's EC2. I have to choose an image
I get a 503 Error when trying to push my database to Amazon RDS
I am trying get Struts 2 and Tiles to work and I am using
Trying to get a JSON output to work with jqGrid 'userdata' option. The example
I'm trying to get Heroku working with European buckets on amazon s3 webserivces using
I have been struggling for the last few hours trying to get this search
I am trying to get started with Amazon AWS Elastic Beanstalk and as I
I'm trying to get set up on the Amazon Cloud to run some hadoop
I have setup a new EC2 instance on AWS and I'm trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.