Tag: MacOS

  • Enhancing Your macOS Terminal Workflow: Creating an Alias for ‘ll’ to ‘ls -als’

    To list files and directories with detailed information using the ll command in the macOS terminal, you can create an alias for ls -als. Here’s how you can do it:

    1. Open your terminal.

    2. Run the following command to open your shell profile configuration file in a text editor. This file is usually .bashrc or .bash_profile.

    nano ~/.bashrc
    
    1. Add the following line to create an alias for ll to execute ls -als.
    alias ll='ls -als'
    
    1. Save and exit the text editor by pressing Ctrl + O to write the changes and then Enter, followed by Ctrl + X to exit.

    2. Source your profile to apply the changes without having to restart the terminal.

    source ~/.bashrc
    

    Now you can use the ll command to list files and directories with detailed information, just like you would with ls -als. The alias will make your terminal experience more efficient and convenient.

    Possible Issue: If the source has to be updated after each new terminal window.

    Run echo $SHELL to check if bash or zsh.

    If you’re using the zsh shell, the steps to create an alias for ll will be slightly different than for the bash shell. Here’s what you should do:

    1. Open Configuration File: Open your zsh configuration file, which is usually ~/.zshrc, in a text editor. You can do this using the following command:

      nano ~/.zshrc
      
    2. Add Alias: Add the alias for ll by including the following line in your ~/.zshrc file:

      alias ll='ls -als'
      
    3. Save and Exit: Save the changes and exit the text editor (Nano) by pressing Ctrl + O to write changes, then Enter, and Ctrl + X to exit.

    4. Apply Changes: To apply the changes to your current terminal session, run:

      source ~/.zshrc
      

    Now, whenever you open a new terminal session, the ll command should automatically be aliased to ls -als without needing to run source ~/.zshrc each time.

    Title and body written by ChatGPT.

    Enhancing Your macOS Terminal Workflow: Creating an Alias for ‘ll’ to ‘ls -als’
  • MacOS XAMPP, setup example.com website

    To set up a website with XAMPP on macOS and create a virtual host for it, you can follow these steps:

    1. Open the Terminal application on your Mac.
    2. Navigate to the XAMPP directory by typing the following command:
      cd /Applications/XAMPP
    3. Once you are in the XAMPP directory, navigate to the Apache configuration folder by typing the following command:
      cd etc/apache2
    4. In the Apache configuration folder, you will find a file called httpd.conf. Open this file in a text editor such as nano or vim by typing the following command:
      sudo nano httpd.conf
    5. In the httpd.conf file, locate the following line:
      # Virtual hosts
      # Include etc/extra/httpd-vhosts.conf
    6. Remove the # at the beginning of the second line to uncomment it.
    7. Save and close the httpd.conf file.
    8. Navigate to the Apache extra configuration folder by typing the following command:
      cd extra
    9. In the extra folder, you will find a file called httpd-vhosts.conf. Open this file in a text editor by typing the following command:
      sudo nano httpd-vhosts.conf
    10. At the bottom of the file, add the following code to create a virtual host for your WordPress website:
      <VirtualHost *:80>
          DocumentRoot "/Applications/XAMPP/htdocs/example.com"
          ServerName example.com
          ServerAlias www.example.com
          ErrorLog "/Applications/XAMPP/logs/example.com-error_log"
          CustomLog "/Applications/XAMPP/logs/example.com-access_log" common
          <Directory "/Applications/XAMPP/htdocs/example.com">
              AllowOverride All
          </Directory>
      </VirtualHost>
    11. Replace “example.com” with your website’s domain name.
    12. Save and close the httpd-vhosts.conf file.
    13. Restart Apache by typing the following command:
      sudo /Applications/XAMPP/xamppfiles/bin/apachectl restart
    14. Download and install WordPress into the newly created directory (example.com in this example) by following the instructions on the WordPress website.
    15. Open your web browser and type in your website’s domain name (e.g. http://example.com) to access your WordPress website.
    MacOS XAMPP, setup example.com website