LangChain OpenTutorial
  • 🦜️🔗 The LangChain Open Tutorial for Everyone
  • 01-Basic
    • Getting Started on Windows
    • 02-Getting-Started-Mac
    • OpenAI API Key Generation and Testing Guide
    • LangSmith Tracking Setup
    • Using the OpenAI API (GPT-4o Multimodal)
    • Basic Example: Prompt+Model+OutputParser
    • LCEL Interface
    • Runnable
  • 02-Prompt
    • Prompt Template
    • Few-Shot Templates
    • LangChain Hub
    • Personal Prompts for LangChain
    • Prompt Caching
  • 03-OutputParser
    • PydanticOutputParser
    • PydanticOutputParser
    • CommaSeparatedListOutputParser
    • Structured Output Parser
    • JsonOutputParser
    • PandasDataFrameOutputParser
    • DatetimeOutputParser
    • EnumOutputParser
    • Output Fixing Parser
  • 04-Model
    • Using Various LLM Models
    • Chat Models
    • Caching
    • Caching VLLM
    • Model Serialization
    • Check Token Usage
    • Google Generative AI
    • Huggingface Endpoints
    • HuggingFace Local
    • HuggingFace Pipeline
    • ChatOllama
    • GPT4ALL
    • Video Q&A LLM (Gemini)
  • 05-Memory
    • ConversationBufferMemory
    • ConversationBufferWindowMemory
    • ConversationTokenBufferMemory
    • ConversationEntityMemory
    • ConversationKGMemory
    • ConversationSummaryMemory
    • VectorStoreRetrieverMemory
    • LCEL (Remembering Conversation History): Adding Memory
    • Memory Using SQLite
    • Conversation With History
  • 06-DocumentLoader
    • Document & Document Loader
    • PDF Loader
    • WebBaseLoader
    • CSV Loader
    • Excel File Loading in LangChain
    • Microsoft Word(doc, docx) With Langchain
    • Microsoft PowerPoint
    • TXT Loader
    • JSON
    • Arxiv Loader
    • UpstageDocumentParseLoader
    • LlamaParse
    • HWP (Hangeul) Loader
  • 07-TextSplitter
    • Character Text Splitter
    • 02. RecursiveCharacterTextSplitter
    • Text Splitting Methods in NLP
    • TokenTextSplitter
    • SemanticChunker
    • Split code with Langchain
    • MarkdownHeaderTextSplitter
    • HTMLHeaderTextSplitter
    • RecursiveJsonSplitter
  • 08-Embedding
    • OpenAI Embeddings
    • CacheBackedEmbeddings
    • HuggingFace Embeddings
    • Upstage
    • Ollama Embeddings With Langchain
    • LlamaCpp Embeddings With Langchain
    • GPT4ALL
    • Multimodal Embeddings With Langchain
  • 09-VectorStore
    • Vector Stores
    • Chroma
    • Faiss
    • Pinecone
    • Qdrant
    • Elasticsearch
    • MongoDB Atlas
    • PGVector
    • Neo4j
    • Weaviate
    • Faiss
    • {VectorStore Name}
  • 10-Retriever
    • VectorStore-backed Retriever
    • Contextual Compression Retriever
    • Ensemble Retriever
    • Long Context Reorder
    • Parent Document Retriever
    • MultiQueryRetriever
    • MultiVectorRetriever
    • Self-querying
    • TimeWeightedVectorStoreRetriever
    • TimeWeightedVectorStoreRetriever
    • Kiwi BM25 Retriever
    • Ensemble Retriever with Convex Combination (CC)
  • 11-Reranker
    • Cross Encoder Reranker
    • JinaReranker
    • FlashRank Reranker
  • 12-RAG
    • Understanding the basic structure of RAG
    • RAG Basic WebBaseLoader
    • Exploring RAG in LangChain
    • RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval
    • Conversation-With-History
    • Translation
    • Multi Modal RAG
  • 13-LangChain-Expression-Language
    • RunnablePassthrough
    • Inspect Runnables
    • RunnableLambda
    • Routing
    • Runnable Parallel
    • Configure-Runtime-Chain-Components
    • Creating Runnable objects with chain decorator
    • RunnableWithMessageHistory
    • Generator
    • Binding
    • Fallbacks
    • RunnableRetry
    • WithListeners
    • How to stream runnables
  • 14-Chains
    • Summarization
    • SQL
    • Structured Output Chain
    • StructuredDataChat
  • 15-Agent
    • Tools
    • Bind Tools
    • Tool Calling Agent
    • Tool Calling Agent with More LLM Models
    • Iteration-human-in-the-loop
    • Agentic RAG
    • CSV/Excel Analysis Agent
    • Agent-with-Toolkits-File-Management
    • Make Report Using RAG, Web searching, Image generation Agent
    • TwoAgentDebateWithTools
    • React Agent
  • 16-Evaluations
    • Generate synthetic test dataset (with RAGAS)
    • Evaluation using RAGAS
    • HF-Upload
    • LangSmith-Dataset
    • LLM-as-Judge
    • Embedding-based Evaluator(embedding_distance)
    • LangSmith Custom LLM Evaluation
    • Heuristic Evaluation
    • Compare experiment evaluations
    • Summary Evaluators
    • Groundedness Evaluation
    • Pairwise Evaluation
    • LangSmith Repeat Evaluation
    • LangSmith Online Evaluation
    • LangFuse Online Evaluation
  • 17-LangGraph
    • 01-Core-Features
      • Understanding Common Python Syntax Used in LangGraph
      • Title
      • Building a Basic Chatbot with LangGraph
      • Building an Agent with LangGraph
      • Agent with Memory
      • LangGraph Streaming Outputs
      • Human-in-the-loop
      • LangGraph Manual State Update
      • Asking Humans for Help: Customizing State in LangGraph
      • DeleteMessages
      • DeleteMessages
      • LangGraph ToolNode
      • LangGraph ToolNode
      • Branch Creation for Parallel Node Execution
      • Conversation Summaries with LangGraph
      • Conversation Summaries with LangGraph
      • LangGrpah Subgraph
      • How to transform the input and output of a subgraph
      • LangGraph Streaming Mode
      • Errors
      • A Long-Term Memory Agent
    • 02-Structures
      • LangGraph-Building-Graphs
      • Naive RAG
      • Add Groundedness Check
      • Adding a Web Search Module
      • LangGraph-Add-Query-Rewrite
      • Agentic RAG
      • Adaptive RAG
      • Multi-Agent Structures (1)
      • Multi Agent Structures (2)
    • 03-Use-Cases
      • LangGraph Agent Simulation
      • Meta Prompt Generator based on User Requirements
      • CRAG: Corrective RAG
      • Plan-and-Execute
      • Multi Agent Collaboration Network
      • Multi Agent Collaboration Network
      • Multi-Agent Supervisor
      • 08-LangGraph-Hierarchical-Multi-Agent-Teams
      • 08-LangGraph-Hierarchical-Multi-Agent-Teams
      • SQL-Agent
      • 10-LangGraph-Research-Assistant
      • LangGraph Code Assistant
      • Deploy on LangGraph Cloud
      • Tree of Thoughts (ToT)
      • Ollama Deep Researcher (Deepseek-R1)
      • Functional API
      • Reflection in LangGraph
  • 19-Cookbook
    • 01-SQL
      • TextToSQL
      • SpeechToSQL
    • 02-RecommendationSystem
      • ResumeRecommendationReview
    • 03-GraphDB
      • Movie QA System with Graph Database
      • 05-TitanicQASystem
      • Real-Time GraphRAG QA
    • 04-GraphRAG
      • Academic Search System
      • Academic QA System with GraphRAG
    • 05-AIMemoryManagementSystem
      • ConversationMemoryManagementSystem
    • 06-Multimodal
      • Multimodal RAG
      • Shopping QnA
    • 07-Agent
      • 14-MoARAG
      • CoT Based Smart Web Search
      • 16-MultiAgentShoppingMallSystem
      • Agent-Based Dynamic Slot Filling
      • Code Debugging System
      • New Employee Onboarding Chatbot
      • 20-LangGraphStudio-MultiAgent
      • Multi-Agent Scheduler System
    • 08-Serving
      • FastAPI Serving
      • Sending Requests to Remote Graph Server
      • Building a Agent API with LangServe: Integrating Currency Exchange and Trip Planning
    • 08-SyntheticDataset
      • Synthetic Dataset Generation using RAG
    • 09-Monitoring
      • Langfuse Selfhosting
Powered by GitBook
On this page
  • Getting Started on Mac
  • Overview
  • Table of Contents
  • Opening Terminal
  • Installing Homebrew
  • Verifying Xcode Installation
  • Downloading Practice Code
  • Installing Pyenv
  • Installing Python
  • Installing Poetry
  • Installing Visual Studio Code
  1. 01-Basic

02-Getting-Started-Mac

PreviousGetting Started on WindowsNextOpenAI API Key Generation and Testing Guide

Last updated 28 days ago

Getting Started on Mac

  • Author:

  • Peer Review: ,

  • Proofread :

  • This is a part of

Overview

This guide provides a comprehensive setup process tailored for developing with LangChain on a Mac. LangChain is a framework for building applications powered by large language models (LLMs), and this guide ensures your environment is fully optimized for seamless integration and development.

Table of Contents


Opening Terminal

  • Open Spotlight Search by pressing Command + Space .

  • Search for terminal and press Enter to open the Terminal.

Installing Homebrew

Running the Homebrew Installation Command

  • Run the following command in the Terminal to install Homebrew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Press ENTER to proceed with the installation.

Configuring Homebrew Environment

  • Run the following command to check your username:

    
    whoami
  • Check the installation path of Homebrew:

    
    which brew
  • Verify the installation path of Homebrew:

    • Case 1 : If the output is /opt/homebrew/bin/brew , use the following command to configure the environment:

      echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<your-username>/.zprofile
    • Case 2 : If the output is /usr/local/bin/brew , use the following command:

      echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/<your-username>/.zprofile

Verifying Xcode Installation

To check if Xcode Command Line Tools are installed, run the following command in your terminal:

xcode-select --install

Downloading Practice Code

Verifying Git Installation

  • Check if Git is installed by running the following command in your terminal:

    git --version
  • If the command outputs the Git version, you already have Git installed, and no further action is required.

  • If Git is not installed, you can install it using Homebrew:

    brew install git
  • After installation, verify Git again:

    git --version

Downloading Practice Code with Git

  • Navigate to the Documents folder (or any other folder where you want to download the practice code). Use the following command:

    cd Documents
  • If you want to use a different directory, replace Documents with your desired path.

  • Use the git command to download the practice code from the repository. Run the following command in your terminal:

    git clone https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial.git
  • The repository will be cloned into a folder named LangChain-OpenTutorial within the selected directory.

Installing Pyenv

Reference


Steps to Install Pyenv

  1. Update Homebrew and install pyenv using the following commands:

    brew update
    brew install pyenv
  2. Add the following lines to your ~/.zshrc file. Copy and paste the commands into your terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
    echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
    echo 'eval "$(pyenv init -)"' >> ~/.zshrc
  3. If you encounter a permissions error, resolve it by running these commands:

    sudo chown $USER ~/.zshrc
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
    echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
    echo 'eval "$(pyenv init -)"' >> ~/.zshrc
  4. Restart the terminal shell to apply the changes:

    exec "$SHELL"

Installing Python

  • Use pyenv to install Python 3.11:

    pyenv install 3.11
  • Set Python 3.11 as the global Python version:

    pyenv global 3.11
  • Restart the shell to ensure the changes take effect:

    exec zsh
  • Verify the installed Python version:

    python --version
  • Ensure the output shows 3.11.

Installing Poetry

Reference


Steps to Install and Configure Poetry

  • Install Poetry using pip3:

    pip3 install poetry
  • Set up a Python virtual environment using Poetry:

     poetry shell
  • Update all Python dependencies in the project:

     poetry update

Installing Visual Studio Code

  • Download Visual Studio Code:

    • Download the installer for your operating system.

  • Install Visual Studio Code:

    • Follow the installation instructions for your system.

    • Dag the application to the Applications folder.

  • Install Extensions:

    • Open Visual Studio Code.

  • Restart Visual Studio Code:

    • After installing the extensions, restart Visual Studio Code to apply the changes.

  • Select Python Environment:

    • Click on "Select Kernel" in the top-right corner of Visual Studio Code.

    • Choose the Python virtual environment you set up earlier.

    • Note: If your environment does not appear in the list, restart Visual Studio Code.


Now, Visual Studio Code is fully set up and ready for development with Python and Jupyter support.

Enter your account password when prompted.

[Reference] Practice code repository:

For detailed documentation, refer to the .

For detailed documentation, refer to the .

Visit the .

Click on the Extensions icon on the left sidebar.

Search for "python" in the Extensions Marketplace and install it.

Search for "jupyter" in the Extensions Marketplace and install it.

LangChain Practice Code
Pyenv GitHub Page
Poetry Official Documentation
Visual Studio Code Download Page
JeongHo Shin
JeongGi Park
Wooseok Jeong
Q0211
LangChain Open Tutorial
Overview
Opening Terminal
Installing Homebrew
Verifying Xcode Installation
Downloading Practice Code
Python and Environment Configuration
Development Tools Setup
Jupyter Extension