Swift 3 only runs from root and once

Need help with C, C++, perl, python, etc?

Swift 3 only runs from root and once

Postby ardawan » 2017-07-02 15:11

Hi,
I've installed Swift 3 language but i can only run it as root and i should type export path command first. It's not permanent.
Code: Select all
root# export PATH="/opt/swift/swift-3.1.1-RELEASE-ubuntu16.10/usr/bin:$PATH"
root# swift
Welcome to Swift version 3.1.1 (swift-3.1.1-RELEASE). Type :help for assistance.
  1>


if i exit from root and enter again i cant run swift only by typing swift in the terminal
Code: Select all
root# swift
bash: swift: command not found

This is same when im trying to run it from user account(Not root)

How can i fix it and run it like python from anywhere (root or user account)?

Thanks in advance
ardawan
 
Posts: 10
Joined: 2017-06-08 05:36

Re: Swift 3 only runs from root and once

Postby arochester » 2017-07-02 15:39

Are you supposed to run Swift, or do you write a Swift program and run that? https://developerslogblog.wordpress.com ... an-jessie/
"Something to be aware of: Debian is a core or source distribution. This means there are many Debian-based distributions. THEY ARE NOT DEBIAN."
arochester
 
Posts: 1048
Joined: 2010-12-07 19:55

Re: Swift 3 only runs from root and once

Postby ardawan » 2017-07-03 07:52

arochester wrote:Are you supposed to run Swift, or do you write a Swift program and run that? https://developerslogblog.wordpress.com ... an-jessie/


I follow this tutorial to install it. but my problem is before type "swift" to tun swift interpreter in terminal i must type this long command everytime
Code: Select all
export PATH="/opt/swift/swift-2.2-RELEASE-ubuntu14.04/usr/bin:$PATH"

Otherwise i get this
Code: Select all
bash: swift: command not found


Is there any way to make it permanent?
ardawan
 
Posts: 10
Joined: 2017-06-08 05:36

Re: Swift 3 only runs from root and once

Postby arochester » 2017-07-03 08:29

Change as appropriate

At this point, you have Swift installed. Next step is to add it to your system PATH:
Code: Select all
1 export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH

If you want to permanently add Swift to your PATH, use:

Code: Select all
1 echo 'export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH' >> .profile
2 source .profile

- https://www.solarianprogrammer.com/2016 ... t-3-linux/
"Something to be aware of: Debian is a core or source distribution. This means there are many Debian-based distributions. THEY ARE NOT DEBIAN."
arochester
 
Posts: 1048
Joined: 2010-12-07 19:55

Re: Swift 3 only runs from root and once

Postby ardawan » 2017-07-04 00:48

arochester wrote:Change as appropriate

At this point, you have Swift installed. Next step is to add it to your system PATH:
Code: Select all
1 export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH

If you want to permanently add Swift to your PATH, use:

Code: Select all
1 echo 'export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH' >> .profile
2 source .profile

- https://www.solarianprogrammer.com/2016 ... t-3-linux/


Before reading your answer I found the way to paste in the profile file.
But I've visited the link and it's good stuff there.
Thanks for sharing
ardawan
 
Posts: 10
Joined: 2017-06-08 05:36


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable