LoginSignup
14
16

More than 5 years have passed since last update.

Macでの.bash_profileの作成方法

Posted at

プライベートでMacBookProを使用している。
最近はGUIでなく、コンソールからの操作が多くなったために
よく使用するコマンドを alias 登録しようと思った。

がしかし、/User/ユーザ名 配下に .bash_profile
ないことに気づいた。

いろいろ検索し、今回は下記の方法で .bash_profile
作成したのでまとめておきます。

手順

  1. GUI画面で、任意のエディタでテキストファイルを作成し、
    デスクトップにbash_profile.testというファイル名で保存する ※ちなみに今回は下記のコマンドを記載してファイルを作成した

alias ll='ls -a'
alias lla='ls -al'
alias son='source ~/.bash_profile'

  1. コンソールを開く

  2. 先ほど作成したテキストファイルをリネームする
    cd ~
    ls -al
    mv -f ./bash_profile.test ./.bash_profile
    source ~/.bash_profile

  3. aliasが有効になったか確認する


※とりあえずQiita初投稿してみました。
自分の勉強だとか気づきメモ的な感じで使用していきたいと思います。

14
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
16